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 <stdio.h> #include <stdlib.h> #include <iostream.h> char map[101][51]; int sign[101]; int value[101]; void main() { int m,n,temp=0,tempSig=0; cin>>n>>m; for(int i=1;i<=m;i++) for(int j=1;j<=n;j++) cin>>map[i][j]; for (i=1;i<m;i++) value[i]=0; for(i=1;i<=m;i++) { for(int ii=1;ii<=n;ii++) { for(int iii=ii;iii<=n;iii++) if(map[i][ii]>map[i][iii]) value[i]++; } } for(i=1;i<=m;i++) { temp=10000; tempSig=0; for(int ii=1;ii<=m;ii++) { if(value[ii]<temp) { temp=value[ii]; tempSig=ii; } } value[tempSig]=10001; for(int j=1;j<=n;j++) cout<<map[tempSig][j]; cout<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator