| ||||||||||
| 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<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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator