結果

問題 No.154 市バス
ユーザー hogeki
提出日時 2017-07-16 15:30:23
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 537 bytes
コンパイル時間 1,038 ms
コンパイル使用メモリ 110,448 KB
実行使用メモリ 27,636 KB
最終ジャッジ日時 2024-10-13 09:04:39
合計ジャッジ時間 1,691 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 5 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
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