結果
問題 | No.154 市バス |
ユーザー | nCk_cv |
提出日時 | 2016-02-18 11:17:33 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 2,879 ms |
コンパイル使用メモリ | 75,336 KB |
実行使用メモリ | 58,824 KB |
最終ジャッジ日時 | 2024-04-21 09:08:59 |
合計ジャッジ時間 | 7,478 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 458 ms
58,820 KB |
testcase_01 | AC | 441 ms
58,244 KB |
testcase_02 | AC | 440 ms
58,532 KB |
testcase_03 | AC | 451 ms
58,556 KB |
testcase_04 | AC | 447 ms
58,824 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | AC | 440 ms
58,512 KB |
testcase_08 | WA | - |
ソースコード
import java.util.*; import java.awt.geom.*; import java.io.*; public class Main { static int[] vx = {1,0,-1,0}; static int[] vy = {0,1,0,-1}; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int T = sc.nextInt(); for(int i = 0; i < T; i++) { char[] in = sc.next().toCharArray(); int ws = 0; int gs = 0; int rs = 0; boolean ok = true; for(int j = 0; j < in.length; j++) { if(in[j] == 'R') rs++; else if(in[j] == 'G') gs++; else if(in[j] == 'W') ws++; if(gs > ws) ok = false; if(rs > gs) ok = false; } if(gs != rs) ok = false; System.out.println((ok?"possible":"impossible")); } } }