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 <cstdlib> #include <iostream> #include <string> using namespace std; int main(int argc, char *argv[]) { int n,m,measure[100]={0}; cin>>n>>m; string *s = new string[100]; int i,j=0,k; for(i=0;i<m;i++) { cin>>s[i]; } for(i=0;i<m;i++) { for(j=0;j<n;j++) { for(k=j;k<n;k++) { if((int)s[i][j]>(int)s[i][k]) measure[i]++; } } } /* for(i=0;i<m;i++) cout<<measure[i]<<endl; */ for(j=0;j<m;j++) { int sign=j,t=measure[j]; for(i=0;i<m;i++) { if(measure[i]<t) { t=measure[i]; sign = i; } } measure[sign]= 50000; cout<<s[sign]<<endl; } system("PAUSE"); return EXIT_SUCCESS; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator