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

怎么老WA啊,大家帮忙看看,呵呵。

Posted by 2007140202 at 2008-11-29 14:23:07 on Problem 1006
#include<iostream> 
using namespace std;
int main()
{ int p,e,i,d;
cin>>p>>e>>i>>d;
int k[10000];
int j=0;
  while(p>=0&&p<365&&e>=0&&e<365&&i>=0&&i<365&&d>=0&&d<365&&p!=-1&&e!=-1&&i!=-1&&d!=-1)
  {
    int s=i;
    while(1)
    {
      s+=33;
      if((s-e)%28==0&&(s-p)%23==0)break;
    }
    k[j]=s-d;
    if(k[j]>21252)k[j]=k[j]%21252;
    j++;
    cin>>p>>e>>i>>d;
  }
  for(int h=0;h<j;h++)
  cout<<"Case "<<h+1<<": "<<"the next triple peak occurs in "<<k[h]<<" days."<<endl;
  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