結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
kou6839
|
| 提出日時 | 2015-02-24 20:58:14 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 587 bytes |
| 記録 | |
| コンパイル時間 | 1,660 ms |
| コンパイル使用メモリ | 82,196 KB |
| 実行使用メモリ | 48,732 KB |
| 最終ジャッジ日時 | 2026-04-30 15:30:35 |
| 合計ジャッジ時間 | 4,439 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 1 |
| other | WA * 7 RE * 1 |
ソースコード
import java.math.*;
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i=0;i<t;i++){
String string = sc.next();
int gc=0;
int rc=0;
for(int j=0;j<string.length();j++){
if(string.charAt(i)=='G') gc++;
if(string.charAt(i)=='R') rc++;
}
if(gc!=rc){
System.out.println("impossible");
continue;
}
if(string.lastIndexOf("R")<string.lastIndexOf("G")){
System.out.println("impossible");
continue;
}
System.out.println("possible");
}
}
}
kou6839