Submission #05622


ソースコード

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
#include<stdio.h>
#include<string.h>
typedef struct{
char name[21];
int koku;
int suga;
int eng;
int sum;
}student;
main(){
student test[10],temp;
int a,i,j;
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%s %d %d %d",test[i].name,&test[i].koku,&test[i].suga,&test[i].eng);
test[i].sum=test[i].koku+test[i].suga+test[i].eng;
}
for(i=0;i<a-1;i++){
for(j=0;j<a-1-i;j++){
if(test[j].sum<test[j+1].sum){
temp=test[j];
test[j]=test[j+1];
test[j+1]=temp;
}
}
}
for(i=0;i<a-1;i++){
for(j=0;j<a-1-i;j++){
if(test[j].sum==test[j+1].sum){
if(strcmp(test[j].name,test[j+1].name)>0){
temp=test[j];
test[j]=test[j+1];
test[j+1]=temp;
}
}
}
}
for(i=1;i<=a;i++){
printf("%d %s %d\n",i,test[i-1].name,test[i-1].sum);
}
return(0);
}

ステータス

項目 データ
問題 0054 - てすと
ユーザー名 ei1630
投稿日時 2016-06-14 16:34:34
言語 C++11
状態 Accepted
得点 2
ソースコード長 852 Byte
最大実行時間 14 ms
最大メモリ使用量 572 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 13 ms 476 KB
1
in2.txt AC 14 ms 460 KB
1
in3.txt AC 13 ms 572 KB
1
in4.txt AC 12 ms 556 KB
1
in5.txt AC 12 ms 420 KB
1