結果
問題 | No.154 市バス |
ユーザー | kuuso1 |
提出日時 | 2015-02-17 23:47:46 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,273 bytes |
コンパイル時間 | 1,114 ms |
コンパイル使用メモリ | 106,752 KB |
実行使用メモリ | 22,016 KB |
最終ジャッジ日時 | 2024-04-21 07:41:36 |
合計ジャッジ時間 | 2,124 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
21,888 KB |
testcase_01 | AC | 44 ms
22,016 KB |
testcase_02 | AC | 44 ms
21,760 KB |
testcase_03 | AC | 44 ms
21,760 KB |
testcase_04 | WA | - |
testcase_05 | AC | 24 ms
17,792 KB |
testcase_06 | AC | 23 ms
17,408 KB |
testcase_07 | AC | 39 ms
21,632 KB |
testcase_08 | AC | 25 ms
17,792 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections; using System.Collections.Generic; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ for(;T>0;T--){ String S=rs(); int r=0; int g=0; int w=0; bool chk=true; for(int i=S.Length-1;i>=0;i--){ if(S[i]=='R'){ r++; continue; } if(S[i]=='W'){ w++; if(r==0){chk=false;break;} if(g==0){chk=false;break;} continue; } if(S[i]=='G'){ g++; if(g>r){chk=false;break;} continue; } } Console.WriteLine( (chk&(r==g)&(r+g+w>=3)&(w>=r))?"possible":"impossible"); } } int T; public Sol(){ T=ri(); } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }