X问题 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3295 Accepted Submission(s): 1068 Problem Description 求在小于等于N的正整数中有多少个X满足:X mo
题解: x = ai ( mod mi ) 1 <= i <= k 先考虑k==2的情况: x = a1 ( mod m1 ) x = a2 ( mod m2 ) 方程组有解的充分必要条件是: d | (a1-a2) ,其中 d = (m1,m2) 证明如下: 必要性: 设 x 是上面同余方程组的解,从而存在整数q1,q2使得x=a1+m1*q1,x=a2+m2*q2,消去x即得a