結果

問題 No.154 市バス
ユーザー rodea
提出日時 2018-02-23 01:39:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 635 bytes
コンパイル時間 768 ms
コンパイル使用メモリ 66,528 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 15:21:34
合計ジャッジ時間 1,387 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 6 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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