結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-10-06 17:35:35 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 476 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 21,120 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-13 08:44:46 |
| 合計ジャッジ時間 | 776 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 6 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &t);
| ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main() {
int t, w, g, r, p[1000], i;
char s;
scanf("%d", &t);
getchar();
for (i = 0; i < t; i++) {
p[i] = w = g = r = 0;
while ((s = getchar()) != '\n') {
if (p[i] != -1) {
if (s == 'W') w++;
else if (s == 'G') g++;
else if (s == 'R') r++;
if (r > g || g > w) p[i] = -1;
}
}
if (r != g) p[i] = -1;
}
for (i = 0; i < t; i++) {
if (p[i] == -1) printf("impossible\n");
else printf("possible\n");
}
return 0;
}
くれちー