#P3455. [POI 2007] ZAP-Queries
[POI 2007] ZAP-Queries
Description
A cryptographer is trying to break a cipher called BSA.
He found that while breaking a message, he also needs to answer the following question:
Given , count the number of pairs such that , , and .
Because there are so many problems to solve, he asks for your help.
Input Format
The first line contains an integer , the number of queries.
Each of the next lines contains three integers .
Output Format
For each query, output a single integer representing the answer.
2
4 5 2
6 4 3
3
2
Hint
Constraints
For all testdata, it is guaranteed that , .
Translated by ChatGPT 5
京公网安备 11011102002149号