| ||||||||||
| 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 | |||||||||
提交总出现诡异的编译错(Problem 1007),在杭电上提交就AC了,为什么呢Source Code
#include<iostream>
#include<map>
using namespace std;
double times=0.001;
int m,n,i,j,k,ct,t;//,counts;
char a[102];
char b[52][102];
int main(){
map<double,int> mapi;
//cin>>counts;
//for(t=0;t<counts;t++){
//if(t) cout<<endl;
cin>>m>>n;
for(i=0;i<n;i++){
ct=0;
//cin.getline(a,102);
scanf("%s",&a);
for(j=0;j<m-1;j++){
for(k=j+1;k<m;k++){
if(a[j]>a[k]) ++ct;
}
}
for(j=0;j<m;j++)b[i][j] = a[j];
if(mapi.find(ct) != mapi.end()){
mapi.insert(pair<double,int>(ct+times,i));
}else{
mapi.insert(pair<double,int>(ct,i));
}
times+=0.001;
}
map<double,int>::iterator iter;
for(iter = mapi.begin();iter != mapi.end();iter++){
cout<<b[iter->second]<<endl;
}
//mapi.erase(mapi.begin(),mapi.end());
//cout<<mapi.size()<<endl;
//}
//system("pause");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator