結果

問題 No.91 赤、緑、青の石
ユーザー YamaKasaYamaKasa
提出日時 2018-07-06 15:22:45
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 862 bytes
コンパイル時間 2,958 ms
コンパイル使用メモリ 78,480 KB
実行使用メモリ 57,956 KB
最終ジャッジ日時 2023-09-13 18:07:35
合計ジャッジ時間 7,797 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 124 ms
56,100 KB
testcase_07 AC 123 ms
55,912 KB
testcase_08 AC 123 ms
56,148 KB
testcase_09 AC 123 ms
55,956 KB
testcase_10 AC 124 ms
56,064 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 122 ms
55,968 KB
testcase_17 AC 123 ms
56,272 KB
testcase_18 AC 124 ms
53,768 KB
testcase_19 AC 123 ms
55,808 KB
testcase_20 AC 128 ms
56,188 KB
testcase_21 AC 122 ms
56,220 KB
testcase_22 AC 122 ms
55,604 KB
testcase_23 AC 122 ms
55,920 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 125 ms
55,912 KB
testcase_28 AC 124 ms
55,624 KB
testcase_29 AC 126 ms
56,080 KB
testcase_30 AC 124 ms
55,612 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);
		int cnt = 0;
		cnt += n[0];
		n[1] -= n[0];
		n[2] -= n[0];

		int a = n[2] / 3;
		if(a >= n[1]) {
			cnt += n[1];
			cnt += (n[2] - 3 * n[1]) / 5;
			System.out.println(cnt);
		}else {
			cnt += a;
			n[1] -= a;
			n[2] -= 3 * a;
			if(n[2] == 0) {
				cnt += n[1] / 5;
			}else if(n[2] == 1){
				if(n[1] - 3 >= 0) {
					cnt += 1;
					n[1] -= 3;
				}
				cnt += n[1] / 5;
			}else {
				if(n[1] - 6 >= 0) {
					cnt += 2;
					n[1] -= 6;
				}else if(n[1] - 3 >= 0) {
					cnt += 1;
					n[1] -= 3;
				}
				cnt += n[1] / 5;
			}
			System.out.println(cnt);
		}
	}
}
0