結果

問題 No.91 赤、緑、青の石
ユーザー ぴろず
提出日時 2014-12-07 20:20:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 323 ms / 5,000 ms
コード長 742 bytes
コンパイル時間 2,716 ms
コンパイル使用メモリ 74,892 KB
実行使用メモリ 57,284 KB
最終ジャッジ日時 2024-06-24 06:44:49
合計ジャッジ時間 12,458 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

package no091;

import java.util.Arrays;
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[] m = new int[3];
		for(int i=0;i<3;i++) {
			m[i] = sc.nextInt();
		}
		for(int i=MAX;i>=0;i--) {
			int[] n = Arrays.copyOf(m, 3);
			int need = 0;
			for(int j=0;j<3;j++) {
				if (n[j] < i) {
					need += i - n[j];
					n[j] = 0;
				}else{
					n[j] -= i;
				}
			}
			//System.out.println(i + "," + need + "," + Arrays.toString(n));
			int amari = 0;
			for(int j=0;j<3;j++) {
				amari += n[j] / 2;
			}
			if (amari >= need) {
				System.out.println(i);
				break;
			}
		}
	}

}
0