Submission #36741


ソースコード

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<stdio.h>
#include<string.h>
#define LL long long
main(){
LL n,jp[100],math[100],eng[100];
LL total[100];
int i,j;
char name[256][100];
scanf("%lld",&n);
for(i=0;i<n;++i){
scanf("%s %lld %lld %lld",name[i],&jp[i],&math[i],&eng[i]);
total[i]=jp[i]+math[i]+eng[i];
}
for(i=0;i<n-1;++i){
for(j=0;j<n-i-1;++j){
if(total[j]<total[j+1]){
//合計の入れ替え
LL temp=total[j];
total[j]=total[j+1];
total[j+1]=temp;
//国語の点数の入れ替え
temp=jp[j];
jp[j]=jp[j+1];
jp[j+1]=temp;
//数学の点数の入れ替え
temp=math[j];
math[j]=math[j+1];
math[j+1]=temp;
//英語の点数の入れ替え
temp=eng[j];
eng[j]=eng[j+1];
eng[j+1]=temp;
//名前の入れ替え
char s[256];
strcpy(s,name[j]);
strcpy(name[j],name[j+1]);
strcpy(name[j+1],s);
}
}
}
for(i=0;i<n;++i){
printf("%s %lld %lld %lld %lld\n",name[i],jp[i],math[i],eng[i],total[i]);
}
return 0;
}

ステータス

項目 データ
問題 0941 - 中間テスト
ユーザー名 crom
投稿日時 2018-06-04 17:51:18
言語 C
状態 Accepted
得点 1
ソースコード長 1153 Byte
最大実行時間 28 ms
最大メモリ使用量 448 KB

セット

セット 得点 Cases
1 ALL 1 / 1 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
input001.txt AC 28 ms 380 KB
1
input002.txt AC 20 ms 400 KB
1
input003.txt AC 18 ms 396 KB
1
input004.txt AC 24 ms 420 KB
1
input005.txt AC 18 ms 448 KB
1