| ||||||||||
| 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 | |||||||||
为什么测试结果都对,还是WA呢???(带代码)#include<iostream>#include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i=0;
while(i<n){
int m,j=0;
cin>>m;
int l[5001],w[5001];
while(j<m){
cin>>l[j]>>w[j];
j++;
}
for(int p=0;p<m;p++){
for(int q=0;q<m;q++){
if(l[q]<l[q+1]){
int k=l[q];
l[q]=l[q+1];
l[q+1]=k;
int h=w[q];
w[q]=w[q+1];
w[q+1]=h;
}
else if(l[q]==l[q+1]){
if(w[q]<w[q+1]){
int h=w[q];
w[q]=w[q+1];
w[q+1]=h;
}
}
}
}
int k=1;int h=0;
for(int p=0;p<m;p++){
if(w[h]<w[p])
h=p;
}
for(int q=0;q<h;q++){
if(w[q]<w[q+1])
k++;
}
cout<<k<<endl;
i++;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator