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 Judas at 2007-04-30 14:38:55 on Problem 3224
In Reply To:为什么这2个代码都是对的? Posted by:20054953 at 2007-04-30 14:09:35
s[2][4] 和 s[4][2]

> 测试数据
> 4
> 0 0 3 2
> 3 0 3 1
> 2 2 0 2
> 3 2 3 0
> 代码一:
> #include<iostream>
> using namespace std;
> 
> main()
> {
> 	int n,s[105][105],i,j,re=0,sum,c;
> 	cin>>n;
> 	for(i=1;i<=n;i++)
> 	{  
> 		for(j=1;j<=n;j++)
> 			cin>>s[i][j];
> 	}  
> 	for(i=1;i<=n;i++)
> 	{
> 		sum=0;
> 		for(j=1;j<=n;j++)
> 		{
> 			if(s[i][j]>s[j][i])
> 				sum++;
> 		}
> 		if(sum>re)
> 		{
> 			re=sum;
> 			c=i;
> 		}
> 	}
> 	cout<<c<<endl;
> }
> 输出结果: 4
>  
> 代码二:
> #include<iostream>
> using namespace std;
> 
> main()
> {
> 	int n,s[105][105],i,j,re=0,sum,c;
> 	cin>>n;
> 	for(i=1;i<=n;i++)
> 	{  
> 		for(j=1;j<=n;j++)
> 			cin>>s[i][j];
> 	}  
> 	for(i=1;i<=n;i++)
> 	{
> 		sum=0;
> 		for(j=1;j<=n;j++)
> 		{
> 			if(s[i][j]==3)
> 				sum++;
> 		}
> 		if(sum>re)
> 		{
> 			re=sum;
> 			c=i;
> 		}
> 	}
> 	cout<<c<<endl;
> }
> 
> 输出结果: 2
> 
> 为什么这2个代码提交都AC?
> 
> 

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