POJ-1006 Biorhythms (中国剩余定理)

来源:互联网 发布:杨丽音 知乎 编辑:程序博客网 时间:2024/04/29 16:52

http://poj.org/problem?id=1006

#include<cstdio>int main(){    int p,e,i,d;    int ct=1;    while(scanf("%d%d%d%d",&p,&e,&i,&d)!=EOF){        if(e==-1)break;        long long ans=(p*5544+e*14421+i*1288+21252-d)%21252;         if(ans==0)ans=21252;        printf("Case %d: the next triple peak occurs in %I64d days.\n",ct++,ans);    }    return 0;}
0 0
原创粉丝点击