結果

問題 No.920 あかあお
ユーザー Hoboteru4484Hoboteru4484
提出日時 2019-11-30 23:30:42
言語 Java21
(openjdk 21)
結果
TLE  
実行時間 -
コード長 832 bytes
コンパイル時間 5,267 ms
コンパイル使用メモリ 71,844 KB
実行使用メモリ 60,100 KB
最終ジャッジ日時 2023-08-13 09:55:40
合計ジャッジ時間 9,541 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
60,100 KB
testcase_01 AC 122 ms
55,624 KB
testcase_02 AC 123 ms
55,796 KB
testcase_03 AC 122 ms
55,736 KB
testcase_04 AC 123 ms
55,768 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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);
  }
}
0