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 |
危急!!!危急!!!危急!!!,那为大侠可以帮忙看一下,结果正确,怎么会是WRONG ANSWER?#include <iostream> #include <stdlib.h> #include <stdio.h> using namespace std; int main(int argc, char *argv[]) { char a[100][100]; int c[100][2],i,j,k,m,n,t; cin>>n>>m; for(i=0;i<m;i++) for(j=0;j<n;j++) cin>>a[i][j]; for(i=0;i<m;i++) {c[i][0]=0; for(j=0;j<n;j++) for(k=j+1;k<n;k++) if(a[i][j]>a[i][k]) c[i][0]+=1; c[i][1]=i; } for(i=1;i<m;i++) for(j=0;j<m-i;j++) if(c[j][0]>c[j+1][0]) {t=c[j][0];c[j][0]=c[j+1][0];c[j+1][0]=t; t=c[j][1];c[j][1]=c[j+1][1];c[j+1][1]=t; } for(i=0;i<m;i++) {k=c[i][1]; puts(a[k]); k=0; } 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