結果

問題 No.516 赤と青の風船
ユーザー yamax3232yamax3232
提出日時 2018-03-16 13:57:25
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 605 bytes
コンパイル時間 2,012 ms
コンパイル使用メモリ 71,748 KB
実行使用メモリ 39,800 KB
最終ジャッジ日時 2023-08-23 11:47:18
合計ジャッジ時間 3,652 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
39,800 KB
testcase_01 AC 119 ms
39,060 KB
testcase_02 WA -
testcase_03 AC 119 ms
39,192 KB
testcase_04 WA -
testcase_05 AC 120 ms
38,956 KB
testcase_06 AC 118 ms
39,400 KB
testcase_07 AC 115 ms
39,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner kb=new Scanner(System.in);
		String s=kb.nextLine();
		int r=0,b=0;
		for(int i=0;i<s.length();i++){
			if(i+2<s.length()){
				if(s.charAt(i)=='R'&&
						s.charAt(i+1)=='E'&&
						s.charAt(i+2)=='D'){
					r++;
				}if(s.charAt(i)=='B'&&
						s.charAt(i+1)=='L'&&
						s.charAt(i+2)=='U'){
					if(
							s.charAt(i+3)=='E')
						b++;
				}
			}
		}
		if(r<b){
			System.out.println("BLUE");
		}else{
			System.out.println("RED");
		}
	}

}
0