結果

問題 No.920 あかあお
コンテスト
ユーザー Hoboteru4484
提出日時 2019-11-30 23:30:42
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
TLE  
実行時間 -
コード長 832 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,437 ms
コンパイル使用メモリ 83,244 KB
実行使用メモリ 52,944 KB
最終ジャッジ日時 2026-05-15 09:25:57
合計ジャッジ時間 6,649 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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