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 |
求高手指点,一直WA.#include<iostream> using namespace std; int abd(int x) {if(x<0) return -x; else return x;} int main() { int p[100],e[100],i[100],d[100],t[100]; int m,x; int total; for(m=0;m<100;m++) { cin>>p[m]>>e[m]>>i[m]>>d[m]; if(p[m]==-1&&e[m]==-1&&i[m]==-1&&d[m]==-1) break; } total=m; for(m=0;m<total;m++) { for(x=d[m]+1;x<d[m]+21253;x++) { if(abd(x-p[m])%23==00&&abd(x-e[m])%28==0&&abd(x-i[m])%33==0) t[m]=x-d[m]; } } for(m=0;m<total;m++) { printf("Case %d: the next triple peak occurs in %d days.\n",m+1,t[m]); } return 0;} Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator