結果
| 問題 |
No.920 あかあお
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-30 23:40:34 |
| 言語 | Java (openjdk 23) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,150 bytes |
| コンパイル時間 | 3,200 ms |
| コンパイル使用メモリ | 74,600 KB |
| 実行使用メモリ | 108,360 KB |
| 最終ジャッジ日時 | 2024-11-21 03:44:37 |
| 合計ジャッジ時間 | 34,635 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 3 |
| other | AC * 5 TLE * 6 |
ソースコード
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 ;
if((redBall + blueBall) == 0){
purpleBall = whiteBall / 2;
}else{
while(redBall > 0 && blueBall > 0){
redBall--;
blueBall--;
purpleBall++;
}
while(whiteBall > 0){
if((redBall + blueBall) > 0){
if(redBall < blueBall){
whiteBall--;
blueBall--;
purpleBall++;
}else if (redBall > blueBall){
whiteBall--;
redBall--;
purpleBall++;
}else {
if(whiteBall < 2){
break;
}else{
whiteBall -= 2;
purpleBall++;
}
}
}
}
}
sc.close();
System.out.println(purpleBall);
}
}