結果

問題 No.91 赤、緑、青の石
ユーザー ぴろずぴろず
提出日時 2014-12-07 19:32:30
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 721 bytes
コンパイル時間 2,013 ms
コンパイル使用メモリ 71,800 KB
実行使用メモリ 56,468 KB
最終ジャッジ日時 2023-09-02 09:22:20
合計ジャッジ時間 8,252 ms
ジャッジサーバーID
(参考情報)
judge12 / judge16
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 157 ms
56,012 KB
testcase_01 WA -
testcase_02 AC 146 ms
55,528 KB
testcase_03 AC 152 ms
55,824 KB
testcase_04 AC 144 ms
55,572 KB
testcase_05 AC 162 ms
55,812 KB
testcase_06 WA -
testcase_07 AC 124 ms
55,816 KB
testcase_08 AC 126 ms
55,704 KB
testcase_09 AC 126 ms
55,884 KB
testcase_10 AC 126 ms
55,716 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 157 ms
55,772 KB
testcase_16 AC 126 ms
55,872 KB
testcase_17 AC 126 ms
55,680 KB
testcase_18 AC 127 ms
55,852 KB
testcase_19 WA -
testcase_20 AC 127 ms
55,904 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 126 ms
55,868 KB
testcase_24 AC 126 ms
55,668 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 126 ms
55,844 KB
testcase_28 WA -
testcase_29 AC 141 ms
55,496 KB
testcase_30 AC 145 ms
56,056 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package no091;

import java.util.Scanner;

public class Main {
	public static final int MAX = 10000000;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] n = new int[3];
		for(int i=0;i<3;i++) {
			n[i] = sc.nextInt();
		}
		while(true) {
			int maxi = -1;
			int mini = -1;
			int max = -1<<29;
			int min = 1<<29;
			for(int i=0;i<3;i++) {
				if (n[i] < min) {
					min = n[i];
					mini = i;
				}else if(n[i] > max) {
					max = n[i];
					maxi = i;
				}
			}
			if (max - min <= 2) {
				break;
			}
			if (n[maxi] <= 2) {
				break;
			}
			n[mini]++;
			n[maxi]-=2;
		}
		System.out.println(Math.min(n[0],Math.min(n[1],n[2])));
	}

}
0