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

求高手帮忙看一下错在哪里!在自己电脑上可以,怎么到这上面就不可以啊?

Posted by 2209080118 at 2010-03-03 23:45:40 on Problem 1006
#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:
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