Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
槽,本想简单点,一直就是过不了,改成暴力法一次就解决了,什么鬼题目啊郁闷顺便贴下代码: #include"stdio.h" #define m 4 int main() { int i,j,k,a[m],b,t; k=1; while(scanf("%d%d%d%d",&a[0],&a[1],&a[2],&a[3]),a[0]!=EOF) { for(i=1;i<=21252;i++) { if((i-a[0])%23==0&&(i-a[1])%28==0&&(i-a[2])%33==0)break; } if(i<=a[3])i=i+21252; t=i-a[3]; if(t>21252)t=t-21252; printf("Case %d: the next triple peak occurs in %d days.\n",k,t); k++; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator