結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2016-02-18 11:17:33 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 2,197 ms |
コンパイル使用メモリ | 75,416 KB |
実行使用メモリ | 59,704 KB |
最終ジャッジ日時 | 2024-10-13 08:02:17 |
合計ジャッジ時間 | 5,645 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
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")); } } }