結果

問題 No.91 赤、緑、青の石
ユーザー rf141rf141
提出日時 2015-12-20 17:19:50
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,000 bytes
コンパイル時間 4,011 ms
コンパイル使用メモリ 77,492 KB
実行使用メモリ 57,756 KB
最終ジャッジ日時 2023-10-17 14:30:58
合計ジャッジ時間 9,065 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 149 ms
55,632 KB
testcase_01 AC 151 ms
57,304 KB
testcase_02 AC 145 ms
57,500 KB
testcase_03 AC 147 ms
57,132 KB
testcase_04 AC 145 ms
57,268 KB
testcase_05 AC 151 ms
57,540 KB
testcase_06 WA -
testcase_07 AC 136 ms
57,572 KB
testcase_08 AC 136 ms
57,404 KB
testcase_09 AC 134 ms
57,756 KB
testcase_10 AC 136 ms
57,668 KB
testcase_11 AC 143 ms
57,564 KB
testcase_12 AC 156 ms
57,388 KB
testcase_13 AC 153 ms
57,640 KB
testcase_14 AC 153 ms
57,156 KB
testcase_15 AC 149 ms
57,708 KB
testcase_16 AC 137 ms
57,492 KB
testcase_17 AC 139 ms
57,124 KB
testcase_18 AC 137 ms
57,552 KB
testcase_19 AC 134 ms
57,532 KB
testcase_20 AC 138 ms
57,148 KB
testcase_21 AC 135 ms
57,264 KB
testcase_22 AC 137 ms
57,536 KB
testcase_23 AC 138 ms
57,448 KB
testcase_24 AC 135 ms
57,596 KB
testcase_25 AC 156 ms
57,676 KB
testcase_26 AC 155 ms
57,676 KB
testcase_27 AC 136 ms
57,612 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 147 ms
57,276 KB
testcase_31 AC 155 ms
57,568 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 base = Math.min(Math.min(r,g),b);
		int red=r-base,green=g-base,blue=b-base;
		int next = 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--;
			next++;
		}
		return base+next;

	}
}
0