結果
| 問題 |
No.447 ゆきこーだーの雨と雪 (2)
|
| ユーザー |
くれちー
|
| 提出日時 | 2016-11-18 23:21:24 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,129 bytes |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 22,656 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-26 08:36:15 |
| 合計ジャッジ時間 | 2,055 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | WA * 25 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:30:49: warning: format not a string literal and no format arguments [-Wformat-security]
30 | sprintf(name_[cnt], name[i]);
| ~~~~^~~
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:14:33: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | for (i = 0; i < n; i++) scanf("%d", &l[i]);
| ^~~~~~~~~~~~~~~~~~
main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d", &t);
| ^~~~~~~~~~~~~~~
main.c:21:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
21 | scanf("%s %c", name[i], &p[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <string.h>
int score(int star, int rank) {
return 50 * star + 50 * star / (0.8 + 0.2 * rank);
}
int main() {
int n, l[26], t;
char name[4000][17], p[4000];
int i, j;
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &l[i]);
scanf("%d", &t);
char name_[4000][17];
int ssum[4000], s[26][4000], cnt = 0, flag, q[26] = {}, no;
for (i = 0; i < t; i++) {
scanf("%s %c", name[i], &p[i]);
flag = 1;
for (j = 0; j < cnt; j++) {
if (strcmp(name_[j], name[i]) == 0) {
flag = 0;
break;
}
}
if (flag) {
sprintf(name_[cnt], name[i]);
cnt++;
}
for (j = 0; j < cnt; j++) {
if (strcmp(name_[j], name[i]) == 0) {
no = j;
break;
}
}
int tmp = p[i] - 'A';
q[tmp]++;
ssum[no] += (s[tmp][no] = score(l[tmp], q[tmp]));
}
int max;
for (i = 0; i < cnt; i++) {
no = 0;
max = ssum[0];
for (j = 0; j < cnt; j++) {
if (ssum[j] >= max) {
max = ssum[j];
no = j;
flag = 0;
}
}
printf("%d %s ", i + 1, name_[no]);
for (j = 0; j < n; j++) printf("%d ", s[j][no]);
printf("%d\n", ssum[no]);
ssum[no] = -1;
}
return 0;
}
くれちー