中国剩余定理-----poj 1006


中国剩余定理的手搓题

int main() {
    int a,b,c,d,i=1;
    while(cin >> a >> b >> c >> d && a>-1&&b>-1&&c>-1&&d>-1) {
        int n = (5544 * a + 14421 * b + 1288 * c) %21252 - d;
        n = (n+21252) % 21252;
        if(n == 0) n = 21252;
        cout <<"Case " << i++ << ": the next triple peak occurs in " << n << " days." << endl;
    }
    return 0;
}