結果

問題 No.91 赤、緑、青の石
ユーザー rf141rf141
提出日時 2015-12-20 17:21:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 937 bytes
コンパイル時間 3,432 ms
コンパイル使用メモリ 77,780 KB
実行使用メモリ 57,724 KB
最終ジャッジ日時 2023-10-17 14:31:08
合計ジャッジ時間 8,589 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
57,464 KB
testcase_01 AC 148 ms
57,524 KB
testcase_02 AC 147 ms
57,404 KB
testcase_03 AC 150 ms
55,408 KB
testcase_04 AC 152 ms
57,520 KB
testcase_05 AC 150 ms
57,476 KB
testcase_06 WA -
testcase_07 AC 134 ms
57,568 KB
testcase_08 AC 133 ms
57,440 KB
testcase_09 AC 131 ms
57,408 KB
testcase_10 AC 131 ms
57,584 KB
testcase_11 AC 150 ms
57,688 KB
testcase_12 AC 151 ms
57,484 KB
testcase_13 AC 152 ms
57,460 KB
testcase_14 AC 156 ms
57,520 KB
testcase_15 AC 154 ms
57,540 KB
testcase_16 AC 133 ms
57,512 KB
testcase_17 AC 130 ms
57,712 KB
testcase_18 AC 132 ms
57,480 KB
testcase_19 AC 132 ms
57,456 KB
testcase_20 AC 133 ms
57,656 KB
testcase_21 AC 133 ms
57,480 KB
testcase_22 AC 134 ms
57,468 KB
testcase_23 AC 133 ms
57,488 KB
testcase_24 AC 135 ms
57,444 KB
testcase_25 AC 148 ms
57,484 KB
testcase_26 AC 154 ms
57,496 KB
testcase_27 AC 151 ms
57,628 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 150 ms
57,492 KB
testcase_31 AC 160 ms
57,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
public class Main{
	public static void main(String... args){
		Scanner scan = new Scanner(System.in);
		int r = scan.nextInt();
		int g = scan.nextInt();
		int b = scan.nextInt();
		System.out.println(Calc(r,g,b));
	}

	public static int Calc(int r,int g,int b){
		int red=r,green=g,blue=b;
		int sum = 0;
		while(true){
			if(red == 0){
				if(Math.max(green,blue) > 2){
					if(blue > green){
						blue -= 2;
					}else{
						green -= 2;
					}
				}else{
					break;
				}
				red++;
			}else if(green == 0){
				if(Math.max(red,blue) > 2){
					if(blue > red){
						blue -= 2;
					}else{
						red -= 2;
					}
				}else{
					break;
				}
				green++;
			}else if(blue == 0){
				if(Math.max(red,green) > 2){
					if(green > red){
						green -= 2;
					}else{
						red -= 2;
					}
				}else{
					break;
				}
				blue++;
			}
			red--;green--;blue--;
			sum++;
		}
		return sum;

	}
}
0