結果

問題 No.91 赤、緑、青の石
ユーザー scache
提出日時 2014-12-07 19:57:59
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 873 bytes
コンパイル時間 3,409 ms
コンパイル使用メモリ 77,656 KB
実行使用メモリ 56,388 KB
最終ジャッジ日時 2024-06-11 16:19:13
合計ジャッジ時間 9,493 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #


import java.util.Arrays;
import java.util.Scanner;

public class Main91 {
	public static void main(String[] args) {
		Main91 p = new Main91();
	}

	public Main91() {
		Scanner sc = new Scanner(System.in);
		int[] c = new int[3];
		for(int i=0;i<3;i++)
			c[i] = sc.nextInt();
		solve(c);
	}

	private void solve(int[] c) {
		int res=0;
		int last =0;
		int cur =1;
		while(cur!=last){
			last =cur;
			cur = 0;
			Arrays.sort(c);
			res += c[0];
			for(int i=c.length-1;i>=0;i--)
				c[i] -= c[0];
			
			c[0] += (c[2]-c[1])/2;
			c[2] = c[2]-c[0]*2;
			for(int i=c.length-1;i>=0;i--)
				cur +=c[i];
		}
		Arrays.sort(c);
		while(c[2]>=3){
			c[2]-=2;
			c[0]+=1;
			if(c[1]>=1){
				for(int i=c.length-1;i>=0;i--)
					c[i]--;
				res++;
			}
			
			Arrays.sort(c);
				
		}
		
		System.out.println(res);
	}

	

}
0