10343 - 电网

在本题中,格点是指横纵坐标皆为整数的点。 为了圈养他的牛,农夫约翰建造了一个三角形的电网。他从原点(0,0)牵出一根通电的电线,连接格点[n,m](0<n,m<32000),再连接格点[p,0](p>0),最后回到原点。 牛可以在不碰到电网的情况下被放到电网内部的每一个格点上(十分苗条的牛)。如果一个格点碰到了电网,牛绝对不可以被放到该格点之上。那么有多少头牛可以被放到农夫约翰的电网中去呢?

输入

输入文件只有一行,包含三个用空格隔开的整数:n,m和p。

输出

输出文件只有一行,包含一个整数,代表能被指定的电网包含的牛的数目。

样例

输入

7 5 10

输出

20

提示

Electric Fence Don Piele In this problem, `lattice points' in the plane are points with integer coordinates.

In order to contain his cows, Farmer John constructs a triangular electric fence by stringing a "hot" wire from the origin (0,0) to a lattice point [n,m] (0<=;n<32000, 0<m<32000), then to a lattice point on the positive x axis [p,0] (p>0), and then back to the origin (0,0).

A cow can be placed at each lattice point within the fence without touching the fence (very thin cows). Cows can not be placed on lattice points that the fence touches. How many cows can a given fence hold?

PROGRAM NAME: fence9 INPUT FORMAT The single input line contains three space-separated integers that denote n, m, and p.

SAMPLE INPUT (file fence9.in) 7 5 10

OUTPUT FORMAT A single line with a single integer that represents the number of cows the specified fence can hold.

SAMPLE OUTPUT (file fence9.out) 20

时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题