Submission #19609
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | #include<stdio.h> typedef struct { char name[21]; int sum; int jap; int math; int eng; }Student; int main(){ Student std[10],temp; int n,i,v; scanf ( "%d" ,&n); for (i=0;i<n;i++){ scanf ( "%s %d %d %d" ,std[i].name,&std[i].jap,&std[i].math,&std[i].eng); std[i].sum=std[i].jap+std[i].math+std[i].eng; } for (i=0;i<n;i++){ for (v=0;v<n-1-i;v++){ if (std[v].sum==std[v+1].sum){ if (std[v].name[0]>std[v+1].name[0]){ temp=std[v]; std[v]=std[v+1]; std[v+1]=temp; } } if (std[v].sum<std[v+1].sum){ temp=std[v]; std[v]=std[v+1]; std[v+1]=temp; } } } for (i=0;i<n;i++){ printf ( "%d %s %d\n" ,i+1,std[i].name,std[i].sum); } return (0); } |
ステータス
項目 | データ |
---|---|
問題 | 0054 - てすと |
ユーザー名 | ei1729 |
投稿日時 | 2017-06-16 17:43:26 |
言語 | C++11 |
状態 | Accepted |
得点 | 2 |
ソースコード長 | 729 Byte |
最大実行時間 | 14 ms |
最大メモリ使用量 | 720 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | ALL | 2 / 2 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # |
---|---|---|---|---|
in1.txt | AC | 11 ms | 480 KB |
1
|
in2.txt | AC | 11 ms | 720 KB |
1
|
in3.txt | AC | 13 ms | 564 KB |
1
|
in4.txt | AC | 9 ms | 676 KB |
1
|
in5.txt | AC | 14 ms | 532 KB |
1
|