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