| ||||||||||
| 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 | |||||||||
Re:请高手帮忙看看,我对那些变态数据都测试过了,为什么还是WA?In Reply To:请高手帮忙看看,我对那些变态数据都测试过了,为什么还是WA? Posted by:chygr at 2007-09-25 18:19:16 虽然这题现在过了,但是还是想请教一下为什么之前的这个程序是错误的,我用了所有的测试数据都通过了的
> #include<iostream>
> using namespace std;
>
> int main(){
> int p,e,i,d,num = 1,result;
> while(cin>>p>>e>>i>>d){
> if(p == -1 & e == -1 & i == -1 & d == -1) break;
> else{
> while(i >= 0& p>=0 & e>=0){
> i-=33;
> p-=23;
> e-=28;
> }
> i+=33;
> p+=23;
> e+=28;
> while(1){
> if( (i - p)%23 == 0 & (i - e)%28 == 0 )
> { result = i-d;
> if(result > 0){
> cout<<"Case "<<num<<": the next triple peak occurs in "<<result<<" days."<<endl;break;}
> }
> i+=33;}
> num++;
> }}
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator