Submission #20216


ソースコード

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

ステータス

項目 データ
問題 0054 - てすと
ユーザー名 ei1710
投稿日時 2017-06-22 16:00:00
言語 C
状態 Accepted
得点 2
ソースコード長 761 Byte
最大実行時間 28 ms
最大メモリ使用量 588 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 10 ms 380 KB
1
in2.txt AC 10 ms 536 KB
1
in3.txt AC 28 ms 588 KB
1
in4.txt AC 10 ms 416 KB
1
in5.txt AC 10 ms 344 KB
1