| ||||||||||
| 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:求助!!!为什么总是RE?自己运行就没问题In Reply To:求助!!!为什么总是RE?自己运行就没问题 Posted by:a806855059 at 2016-07-17 20:12:50 > #include <stdio.h>
> #include <string.h>
>
> int main () {
> int n,m;
> scanf("%d %d", &n, &m);
> char dna[50][11];
> char temp[11];
> int measure[50];
> for (int i = 0; i < m; i++) {
> scanf("%s", dna[i]);
> int t = 0;
> for (int j = 0; j < n; j++) {
> for (int k = j; k < n; k++) {
> if (dna[i][j] - dna[i][k] > 0) {
> t++;
> }
> }
> }
> measure[i] = t;
> }
> for (int i = 0; i < m; i++) {
> int low = i;
> for (int j = i; j < m; j++) {
> if (measure[j] < measure[low]) {
> low = j;
> }
> }
> strcpy(temp, dna[low]);
> strcpy(dna[low], dna[i]);
> strcpy(dna[i], temp);
> int tmp = measure[i];
> measure[i] = measure[low];
> measure[low] = tmp;
> }
> for (int i = 0; i < m; i++) {
> printf("%s\n", dna[i]);
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator