結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2015-12-31 10:13:18 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 922 bytes |
コンパイル時間 | 843 ms |
コンパイル使用メモリ | 103,552 KB |
実行使用メモリ | 31,744 KB |
最終ジャッジ日時 | 2024-10-13 07:54:13 |
合計ジャッジ時間 | 7,169 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | TLE * 1 -- * 7 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; class Program { static void Main() { int t = int.Parse(Console.ReadLine()); for (int i=0;i< t; i++) { int g = 0, r = 0, w = 0; string s = Console.ReadLine(); for (int j=0; j < s.Length; j++) { if (s[j] == 'W') w++; if (s[j] == 'G') g++; if (s[j] == 'R') r++; int cntg = s.Length - s.Replace("G", "").Length; if (r > g || g > w || (g == cntg && s[j] == 'W')) { Console.WriteLine("impossible"); break; } if (j == s.Length - 1) { if (s[j] == 'R' && r == g && w >= g) Console.WriteLine("possible"); else Console.WriteLine("impossible"); } } } } }