結果

問題 No.154 市バス
ユーザー hogekihogeki
提出日時 2017-07-16 15:34:29
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 620 bytes
コンパイル時間 924 ms
コンパイル使用メモリ 110,244 KB
実行使用メモリ 31,704 KB
最終ジャッジ日時 2024-04-21 10:17:27
合計ジャッジ時間 1,999 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
21,632 KB
testcase_01 AC 46 ms
21,504 KB
testcase_02 AC 46 ms
21,760 KB
testcase_03 AC 45 ms
21,632 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 42 ms
21,760 KB
testcase_08 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class Bus
{
	static public void Main(String[] args)
	{
		int T = int.Parse(Console.ReadLine());

		for(int i=0; i < T; i++)
		{
			string S = Console.ReadLine();

			if(S.Length < 3)
			{
				Console.WriteLine("impossible");
				continue;
			}

			int count = 0;

			foreach(char s in S)
			{
				if(s == 'G')
				{
					count++;
				}
				else if(s == 'R')
				{
					if(--count < 0)
					{
						Console.WriteLine("impossible");
						break;
					}
				}
			}

			if(count == 0)
			{
				Console.WriteLine("possible");
			}
			else if(count > 0)
			{
				Console.WriteLine("impossible");
			}

		}
	}
}
0