結果
問題 | No.516 赤と青の風船 |
ユーザー |
|
提出日時 | 2017-10-07 02:45:35 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 57 ms / 2,000 ms |
コード長 | 773 bytes |
コンパイル時間 | 3,319 ms |
コンパイル使用メモリ | 75,000 KB |
実行使用メモリ | 37,180 KB |
最終ジャッジ日時 | 2024-11-17 03:18:38 |
合計ジャッジ時間 | 4,428 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 6 |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class No516{ public static void main(String[] args) { try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] str = new String[3]; setColor(br, str); getColor(str); System.out.println(getColor(str)); } catch (IOException e) { e.getStackTrace(); } } public static void setColor(BufferedReader br, String[] s) throws IOException { for(int i=0; i<3; i++) s[i] = br.readLine(); } public static String getColor(String[] s){ int RED = 0; int BLUE = 0; for(int i=0; i<s.length; i++){ if(s[i].equals("RED")) RED++; else BLUE++; } if(RED > BLUE) return "RED"; else return "BLUE"; } }