結果

問題 No.154 市バス
ユーザー rodearodea
提出日時 2018-02-23 01:39:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 635 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 65,276 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 04:19:27
合計ジャッジ時間 1,247 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
6,816 KB
testcase_01 AC 27 ms
6,940 KB
testcase_02 AC 26 ms
6,940 KB
testcase_03 AC 26 ms
6,940 KB
testcase_04 AC 26 ms
6,940 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 23 ms
6,940 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstring>
using namespace std;

int main()
{
	int t, wcount = 0, gcount = 0, rcount = 0;
	char s[1001];

	cin >> t;

	for (int i = 1; i <= t; i++)
	{
		cin >> s;

		for (int j = 0; j < strlen(s); j++)
		{
			if (s[j] == 'W')
			{
				wcount++;
			}
			if (s[j] == 'G')
			{
				gcount++;
			}
			if (s[j] == 'R')
			{
				rcount++;
			}

			if (wcount < gcount || gcount < rcount)
			{
				cout << "impossible" << endl;
				goto END;
			}
		}
		if (gcount != rcount)
		{
			cout << "impossible" << endl;
			goto END;
		}
		cout << "possible" << endl;
	    END:;
		wcount = 0;
		gcount = 0;
		rcount = 0;
	}
}
0