Submit | All submissions | Best solutions | Back to list |
VTRI - Triangles |
English | Vietnamese |
In the plane, given a rectangular grid with sides parallel to the axes of coordinates. The coordinates of the bottom-left corner is (0, 0) and the top-right corner is (X, Y).
Your task is to count the number of triangles with integer coordinates lying inside the given grid and having areas equal to an integer S.
Input
A single line consisting of three integers: X, Y, S (1 ≤ X, Y ≤ 30, 1 ≤ S ≤ X*Y/2).
Output
A single integer: the number of triangles with integer coordinates lying inside the rectanglular grid and having areas equal to S.
Constraint
There are 50% of the test cases, corresponding to 50% of the grades, in which 1≤X, Y≤10.
Example
Input 2 1 1 Output 6
Added by: | Jimmy |
Date: | 2008-04-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO NODEJS PERL6 SCM qobi VB.NET |
Resource: | VNOI Marathon '08 - Round 1/DivA Problem Setter: Ngô Minh Đức |
hide comments
2012-09-24 15:36:36 Hasan Jaddouh
complete search with some optimization! Last edit: 2012-09-24 15:59:35 |
|
2011-02-12 03:49:15 Arstanbek Miyzamali uulu
it's very easy |