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 yuweiyang12345 at 2011-04-05 12:17:00 on Problem 1083
#include<iostream>
using namespace std;
int main()
{
	int s[400],t[400];
	int c[200];
	int i,j;
	for(i=0;i<200;i++)
		c[i]=0;
	int m,sum=10;
	cin>>i;
	if(i>=1 && i<=400)
	{
		for(m=0;m<i;m++)
			{
		
		cin>>s[m];
		cin>>t[m];
		if(s[m]>t[m])
		{
			int temp;
			temp=s[m];
			s[m]=t[m];
			t[m]=temp;
		}
		if(s[m]<1 || s[m]>400 || t[m]<1 || t[m]>400 || s[m]==t[m])
		{cout<<"error!!"<<endl;return 0;}
			}
	
		for(j=0;j<i-1;j++)
		{
		for(m=j;m<i-1;m++)
			{
			if(t[j]>=s[m+1] || (t[j]%2 == 1 && s[m+1] == t[j]+1))
				{
				c[j]++;
				}
			}
		}
		for(j=0;j<i;j++)
			{
				if(c[j]>0)
					{sum+=10;}
			}
		
		cout<<sum<<endl;


	}
	else cout<<"error!"<<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