結果
問題 |
No.920 あかあお
|
ユーザー |
|
提出日時 | 2019-11-30 23:30:42 |
言語 | Java (openjdk 23) |
結果 |
TLE
|
実行時間 | - |
コード長 | 832 bytes |
コンパイル時間 | 3,683 ms |
コンパイル使用メモリ | 74,700 KB |
実行使用メモリ | 108,360 KB |
最終ジャッジ日時 | 2024-11-21 03:43:52 |
合計ジャッジ時間 | 8,686 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 |
ソースコード
import java.util.Scanner; public class No920 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int redBall = sc.nextInt(); int blueBall = sc.nextInt(); int whiteBall = sc.nextInt(); int purpleBall = 0 ; while(whiteBall > 0){ if((redBall + blueBall) > 0){ if(redBall < blueBall){ whiteBall--; redBall++; }else if (redBall > blueBall){ whiteBall--; blueBall++; }else { if(whiteBall < 2){ break; }else{ whiteBall -= 2; blueBall++; redBall++; } } } } while(redBall > 0 && blueBall > 0){ redBall--; blueBall--; purpleBall++; } sc.close(); System.out.println(purpleBall); } }