結果

問題 No.154 市バス
ユーザー hogekihogeki
提出日時 2017-07-16 15:30:23
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 1,176 ms
コンパイル使用メモリ 103,680 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2024-04-21 10:17:25
合計ジャッジ時間 1,660 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
21,504 KB
testcase_01 AC 39 ms
21,504 KB
testcase_02 AC 39 ms
21,504 KB
testcase_03 AC 37 ms
21,760 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 36 ms
21,632 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();
			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