CT - Counting triangles

Consider a 2D integer grid with lower left corner at (0, 0) and upper right corner at (X, Y). We are interested in isosceles right triangles which all the 3 corners at the grid node (integer coordinates). Your task is to count the number of those triangles.

Input

The input begins with C – number of test cases.
Each test case consists of X, Y.

Output

For each test case, output the result in a line.

Limits

C <= 20
0 <= X, Y <= 1000


Sample input
2
0 3
1 1


Sample output
0
4


Được gửi lên bởi:sieunhan
Ngày:2009-11-29
Thời gian chạy:0.300s-1.5s
Giới hạn mã nguồn:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Ngôn ngữ cho phép:Tất cả ngoại trừ: ASM64 GOSU NODEJS OBJC PERL6 PYPY RUST SED SQLITE VB.NET
Nguồn bài:Le Don Khue - ACM Vietnam Practice

hide comments
2021-05-27 18:00:19
Tham khảo: https://vnspoj.github.io/problems/CT
2017-09-27 09:51:49
Code: http://123link.top/CT
2017-09-13 07:27:07
Code AC: http://shink.in/XFkBz
2017-01-14 13:17:13
Code pascal: http://shink.in/ySPd4
2014-01-22 16:49:00 a;slkfjasl;fkj
bài này đặt tên thế này search lời giải theo từ khóa hơi bị khổ :(
2010-02-16 01:42:32 dhkhtn
dem so tam giac vuong - can.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.