Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

上代码

Posted by solomanII at 2018-04-05 19:59:32 on Problem 1006
#include <stdio.h>

int main() {
    int p = 0, e = 0, i = 0, d = 0, c = 0;
    while (1) {
        scanf("%d %d %d %d", &p, &e, &i, &d);
        if (p == -1) break; c++;
        p %= 23; e %= 28; i %= 33;
        int t = 0;
        while (1) {
            int len = t++ * 23 + p;
            if (len <= d) continue;
            if ((len - e)%28 == 0 && (len - i)%33 == 0) {
                printf("Case %d: the next triple peak occurs in %d days.\n", c, len - d);
                break;
            }
        }
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator