Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:C++做的 达人帮看下:测试都不能通过拉你!你输入四个1结果就已经错了!算法问题!

Posted by feng2017 at 2006-08-12 10:44:40 on Problem 1006
In Reply To:C++做的 达人帮看下 Posted by:zhcmeng at 2006-07-30 09:58:45
> #include<iostream>
> using namespace std;
> int main(){
> 	static int t=1;
> 	int p,e,i,d;
> 	while(cin>>p>>e>>i>>d)
> 	{
> 		if(p==-1&&e==-1&&i==-1&&d==-1)
> 			goto poco;
> 		if(p>=0&&p<=365&&e>=0&&e<=365&&i>=0&&i<=365&&d>=0&&d<=365)
> 		{    
> 		    for(int k=1;k<=21252;k++)
> 			{
> 			    if((k+p)%23==0&&(k+e)%28==0&&(k+i)%33==0)
> 				{
> 				    cout<<"Case "<<t<<": the next triple peak occurs in ";
> 				    if(21252-k-d>0)
> 					{
> 					    cout<<21252-k-d<<" days."<<endl;
> 					    t++;
> 					    break;
> 					}
> 				    if(21252-k-d<=0)
> 					{
> 					    cout<<k-d<<" days."<<endl;
> 					    t++;
> 					    break;
> 					}
> 
> 				}
> 			}
> 		}
> 	}
> poco:
> 	return 0;
> }
> 
> 老说是错误答案 谁给解释下哪错了啊

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator