|
|
I cant understand this problem... what are this "pairs of ties " and "long serial numbers of ties" small a, big b, big n, and the LCM of a and b is larger than n. such as 3 24999998 25000000 Edited by author 21.03.2010 23:41 i divide n numbers into ceil[n/a] segments for each segment, increasing B's ties by add b until it reach a, and count the pairs. such like this: while(j + b <= a) { ans += j * b; j += b; } it use %I64d but not %lld |
|
|