結果

問題 No.91 赤、緑、青の石
ユーザー YamaKasaYamaKasa
提出日時 2018-07-06 16:24:20
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 908 bytes
コンパイル時間 3,820 ms
コンパイル使用メモリ 74,496 KB
実行使用メモリ 56,464 KB
最終ジャッジ日時 2023-09-13 18:08:36
合計ジャッジ時間 7,761 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 139 ms
55,500 KB
testcase_07 AC 124 ms
56,080 KB
testcase_08 AC 127 ms
55,492 KB
testcase_09 AC 126 ms
55,880 KB
testcase_10 AC 123 ms
56,372 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 124 ms
56,128 KB
testcase_17 AC 123 ms
55,904 KB
testcase_18 AC 123 ms
56,376 KB
testcase_19 AC 125 ms
55,976 KB
testcase_20 AC 126 ms
56,004 KB
testcase_21 AC 126 ms
55,768 KB
testcase_22 AC 126 ms
56,028 KB
testcase_23 AC 123 ms
56,108 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 122 ms
56,056 KB
testcase_28 AC 134 ms
55,832 KB
testcase_29 AC 134 ms
55,868 KB
testcase_30 AC 139 ms
56,196 KB
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n[] = new int[3];
		n[0] = scan.nextInt();
		n[1] = scan.nextInt();
		n[2] = scan.nextInt();
		scan.close();
		Arrays.sort(n);
		long cnt = 0;
		cnt += n[0];
		n[1] -= n[0];
		n[2] -= n[0];

		boolean flag = true;
		while(flag) {
			if(n[1] <= 2 && n[2] <= 2) {
				flag = false;
			}else {
				if(n[2] - 3 >= 0 && n[1] >= 1) {
					n[2] -= 3;
					n[1] --;
					cnt ++;
				}else if(n[1] - 3 >= 0 && n[2] >= 1) {
					n[2] --;
					n[1] -= 3;
					cnt ++;
				}else if(n[1] == 0) {
					if(n[2] - 5 >= 0) {
						n[2] -= 5;
						cnt ++;
					}else {
						flag = false;
					}
				}else if(n[2] == 0) {
					if(n[1] - 5 >= 0) {
						n[1] -= 5;
						cnt++;
					}else {
						flag = false;
					}
				}
			}
		}
		System.out.println(cnt);

	}
}
0