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 |
Re:暴力简洁0msIn Reply To:暴力简洁0ms Posted by:416221843 at 2016-11-17 14:17:14 > #include<stdio.h> > #include<string.h> > #include<algorithm> > using namespace std; > int main() > {char a[105][55]; > int i, j, k, x[105] = { 0 }, x1[105] = {0}, m, n; > scanf("%d%d",&n,&m); > for (i = 0; i < m; i++) > scanf("%s",a[i]); > for (i = 0; i < m; i++) > for (j = 0; j < n - 1; j++) > for (k = j + 1; k < n; k++) > if (a[i][k] < a[i][j]) x[i]++,x1[i]++; > sort(x, x + m); > for (i = 0; i < m; i++) > for (j = 0; j < m; j++) > if (x[i] == x1[j]) { printf("%s\n", a[j]); x1[j] = -1; break; } > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator