結果

問題 No.846 メダル
ユーザー 37zigen37zigen
提出日時 2019-07-05 23:48:10
言語 Java21
(openjdk 21)
結果
AC  
実行時間 162 ms / 2,000 ms
コード長 750 bytes
コンパイル時間 2,520 ms
コンパイル使用メモリ 88,068 KB
実行使用メモリ 55,172 KB
最終ジャッジ日時 2024-04-16 08:15:22
合計ジャッジ時間 7,235 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
54,828 KB
testcase_01 AC 137 ms
53,852 KB
testcase_02 AC 159 ms
54,796 KB
testcase_03 AC 161 ms
55,136 KB
testcase_04 AC 133 ms
53,732 KB
testcase_05 AC 135 ms
53,856 KB
testcase_06 AC 160 ms
54,756 KB
testcase_07 AC 136 ms
53,876 KB
testcase_08 AC 156 ms
55,056 KB
testcase_09 AC 156 ms
55,104 KB
testcase_10 AC 157 ms
54,832 KB
testcase_11 AC 159 ms
55,172 KB
testcase_12 AC 135 ms
53,800 KB
testcase_13 AC 133 ms
54,116 KB
testcase_14 AC 157 ms
54,940 KB
testcase_15 AC 132 ms
53,840 KB
testcase_16 AC 134 ms
53,908 KB
testcase_17 AC 161 ms
54,924 KB
testcase_18 AC 136 ms
54,012 KB
testcase_19 AC 136 ms
54,000 KB
testcase_20 AC 157 ms
54,936 KB
testcase_21 AC 158 ms
55,040 KB
testcase_22 AC 157 ms
54,916 KB
testcase_23 AC 135 ms
53,992 KB
testcase_24 AC 143 ms
54,440 KB
testcase_25 AC 158 ms
54,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {

		Scanner sc = new Scanner(System.in);
		long P = sc.nextLong();
		long Q = sc.nextLong();
		long R = sc.nextLong();
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long min = Math.max(P * (A - 1), Q * (A + B - 1));
		min = Math.max(min, R * (A + B + C - 1));
		long max = Math.min(P * A, Q * (A + B));
		max = Math.min(max, R * (A + B + C));
		if (max - min >= 1) {
			System.out.println((min + 1) + " " + max);
		} else {
			System.out.println(-1);
		}
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0