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<iostream> using namespace std; #define N 50 struct BB { int a;int b;int c;int d; }; void chuli(int &a,int b,int c) { while(a>b) {a-=c;} } int bijiao(int &m,int a,int b,int c,int d) {if(a<b) { m=a;return c;} else {m=b;return d;} } int main() { BB s[N]; int n=0; while(1) { cin>>s[n].a>>s[n].b>>s[n].c>>s[n].d; if(s[n].a==-1) break; else n++; } for(int i=0;i<n;i++) {chuli(s[i].a,s[i].d,23);chuli(s[i].b,s[i].d,28);chuli(s[i].c,s[i].d,33);} int min,k; k=bijiao(min,s[i].a,s[i].b,23,28);k=bijiao(min,min,s[i].c,k,33); for(i=0;i<n;i++) { while(1) { min+=k; if(min>s[i].d) if((min-s[i].a)%23==0&&(min-s[i].b)%28==0&&(min-s[i].c)%33==0) { cout<<"Case "<<i<<": the next triple peak occurs in "<<min<<" days. "<<endl; break;} } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator