結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
|
| 提出日時 | 2016-11-20 13:43:28 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 2,139 bytes |
| コンパイル時間 | 237 ms |
| コンパイル使用メモリ | 23,296 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-27 06:54:07 |
| 合計ジャッジ時間 | 1,612 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&l[i]);
| ^~~~~~~~~~~~~~~~~
main.c:14:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d",&t);
| ^~~~~~~~~~~~~~
main.c:21:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%c",&name[0][j]);
| ^~~~~~~~~~~~~~~~~~~~~~~
main.c:27:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
27 | scanf("%c",&p);
| ^~~~~~~~~~~~~~
main.c:53:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
53 | scanf("%c",&p);
| ^~~~~~~~~~~~~~
main.c:80:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
80 | scanf("%c",&p);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<string.h>
int main(){
int n,l[26],t,i,j,player,id,ac[26],score[4000][27],sort[4000],pp,h;
char name[4001][17],p;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",&l[i]);
ac[i]=0;
}
scanf("%d",&t);
player=0;
for(i=0;i<t;i++){
j=-1;
getchar();
do{
j++;
scanf("%c",&name[0][j]);
}while(name[0][j]!=' ');
name[0][j]='\0';
if(player==0){
strcpy(name[1],name[0]);
player++;
scanf("%c",&p);
for(pp=0;pp<n+1;pp++){
score[0][pp]=0;
}
pp=0;
while(pp<25){
if(p=='A'+('B'-'A')*pp){
break;
}
pp++;
}
ac[pp]++;
score[0][pp]=50*l[pp]+(250*l[pp]/(4+ac[pp]));
score[0][n]=score[0][pp];
sort[0]=0;
}else{
id=0;
for(j=1;j<=player;j++){
if(strcmp(name[0],name[j])==0){
id=j;
j=player;
}
}
if(id==0){
player++;
strcpy(name[player],name[0]);
scanf("%c",&p);
for(pp=0;pp<n+1;pp++){
score[player-1][pp]=0;
}
pp=0;
while(pp<25){
if(p=='A'+('B'-'A')*pp){
break;
}
pp++;
}
ac[pp]++;
score[player-1][pp]=50*l[pp]+(250*l[pp]/(4+ac[pp]));
score[player-1][n]=score[player-1][pp];
sort[player-1]=player-1;
pp=player-1;
while(pp>0){
if(score[sort[pp-1]][n]<score[sort[pp]][n]){
h=sort[pp];
sort[pp]=sort[pp-1];
sort[pp-1]=h;
}else{
pp=1;
}
pp--;
}
}else{
scanf("%c",&p);
pp=0;
while(pp<25){
if(p=='A'+('B'-'A')*pp){
break;
}
pp++;
}
ac[pp]++;
score[id-1][pp]=50*l[pp]+(250*l[pp]/(4+ac[pp]));
score[id-1][n]+=score[id-1][pp];
pp=0;
while(sort[pp]!=id-1){
pp++;
}
while(pp>0){
if(score[sort[pp-1]][n]<score[sort[pp]][n]){
h=sort[pp];
sort[pp]=sort[pp-1];
sort[pp-1]=h;
}else{
pp=1;
}
pp--;
}
}
}
}
for(i=0;i<player;i++){
printf("%d %s",i+1,name[sort[i]+1]);
for(j=0;j<=n;j++){
printf(" %d",score[sort[i]][j]);
}
printf("\n");
}
return 0;
}