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 |
三度更新照错不误,严肃地考虑换算法中= =In Reply To:自我更新,增加考虑到在date之前就已经有个triple peak的状况 Posted by:wy at 2004-11-09 20:25:25 出的到底是什么数据啊........ 调试是完全没问题的,难道还有我没想到的漏洞.......||| #include "math.h" #include "stdio.h" void main() { int p[15],e[15],i[15],d[15],tp[15]; int j,k,lim; j=0; do { j++; scanf("%d %d %d %d",&p[j],&e[j],&i[j],&d[j]); if (p[j]-23>0) p[j]=p[j]%23; if (e[j]-28>0) e[j]=e[j]%28; if (i[j]-33>0) i[j]=i[j]%33; } while (p[j]!=-1 && e[j]!=-1 && i[j]!=-1 && d[j]!=-1); lim=j-1; for (j=1;j<=lim;j++) { for (k=1;;k++) { if ((k-i[j])%33!=0) continue; else { if ((k-e[j])%28!=0) continue; else { if ((k-p[j])%23!=0) continue; else { tp[j]=k-d[j]; if (tp[j]<0) tp[j]=tp[j]+21252; break; } } } } } for (j=1;j<=lim;j++) { printf("Case %d: the next triple peak occurs in %d days.\n",j,tp[j]); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator