結果

問題 No.91 赤、緑、青の石
コンテスト
ユーザー kano_town
提出日時 2014-12-07 19:30:15
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 93 ms / 5,000 ms
+ 304µs
コード長 757 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,325 ms
コンパイル使用メモリ 85,748 KB
実行使用メモリ 44,916 KB
最終ジャッジ日時 2026-07-19 04:04:51
合計ジャッジ時間 6,760 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class Yukicoder91 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long r = sc.nextLong(), g = sc.nextLong(), b = sc.nextLong();
		long sum = (r + g + b) / 3;
		long res = 0;
		while (true) {
			if (r == 0) {
				if (Math.max(b, g) > 2) {
					if (b > g) b -= 2;
					else g -= 2;
				}
				else break;
				r++;
			}
			if (g == 0) {
				if (Math.max(r, b) > 2) {
					if (r > b) r -= 2;
					else b -= 2;
				}
				else break;
				g++;
			}
			if (b == 0) {
				if (Math.max(r, g) > 2) {
					if (r > g) r -= 2;
					else g -= 2;
				}
				else break;
				b++;
			}
			r--;
			g--;
			b--;
			res++;
		}
		System.out.println("" + res);

	}
}
0