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 "stdafx.h" #include<iostream> using namespace std; int main() { int num=0; int i=0; int m,n,o,p; while(cin>>m>>n>>o>>p) { if(m==-1&&n==-1&&o==-1&&p==-1) return 0; else{ m=m%23; n=n%28; o=o%33; int value=o+33; while(value<65535) { if((value-m)%23==0&&(value-n)%28==0&&value>p) {num=value; i++; break; } value=value+33; } cout<<"Case "<<i<<": the next triple peak occurs in "<<num-p<<" days."<<endl; } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator