結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
やまじゅん
|
| 提出日時 | 2017-06-30 15:47:16 |
| 言語 | C90 (gcc 15.2.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 158 ms |
| コンパイル使用メモリ | 38,772 KB |
| 最終ジャッジ日時 | 2026-02-24 00:47:38 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 7 WA * 1 |
ソースコード
#include <stdio.h>
int main(void)
{
int times, i, j, white, green, red;
char bus[1001];
scanf("%d", ×);
for (i = 0;i < times;i++) {
scanf("%s", bus);
j = white = green = red = 0;
while (bus[j] != '\0') {
if (bus[j] == 'W')white++;
if (bus[j] == 'G')green++;
if (bus[j] == 'R')red++;
if ((white < green) || (green < red) || (white < red)) {
goto IMPOSSIBLE;
}
j++;
}
if (green == 0 || red == 0 || green != red) {
goto IMPOSSIBLE;
}
printf("possible\n");
continue;
IMPOSSIBLE:
printf("impossible\n");
continue;
}
return 0;
}
やまじゅん