1736 - LL && Triangle
Time Limit : 1 Second
Memory Limit : 128 MB
Submission: 1
Solved: 1
- Description
LL is interested in right angled isosceles triangle(there are two equal sides and a 90° angle) recently. Now he wants to solve a problem about right angled isosceles triangle.
You are given a grid map whose size is n*m, there are (n+1)*(m+1) integer grid points. The most upper left integer grid point is (1,1),the most lower right integer grid point is (n+1,m+1).LL knows a integer grid point O(x,y), he wants to find two other integer grid points which are in grid map to make them form a right angled isosceles triangle and the ∠O=90°.
Can you help him calculate the number of right angled isosceles triangles he can find?
- Input
The first line contains a number T(0<T≤100),represents the number of test case.
For each case, it contains four integer n,m,x,y (1≤n,m≤10^5,1≤x≤n+1,1≤y≤m+1).
- Output
For each case, first output “Case #t:”, starts form 1.
Next line output the answer.
- sample input
-
3 2 2 1 1 3 3 2 2 201 51931 164 8553
- sample output
-
Case #1: 2 Case #2: 11 Case #3: 40803
- hint
- source
- WUST