結果

問題 No.846 メダル
ユーザー tentententen
提出日時 2020-10-09 11:39:12
言語 Java19
(openjdk 21)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 2,850 ms
コンパイル使用メモリ 77,776 KB
実行使用メモリ 58,696 KB
最終ジャッジ日時 2023-09-27 12:36:01
合計ジャッジ時間 7,015 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 146 ms
56,820 KB
testcase_01 AC 118 ms
55,620 KB
testcase_02 AC 144 ms
56,948 KB
testcase_03 AC 143 ms
56,924 KB
testcase_04 AC 115 ms
55,940 KB
testcase_05 AC 115 ms
55,620 KB
testcase_06 AC 142 ms
57,160 KB
testcase_07 AC 114 ms
55,936 KB
testcase_08 AC 138 ms
56,936 KB
testcase_09 AC 139 ms
56,832 KB
testcase_10 AC 143 ms
56,788 KB
testcase_11 AC 142 ms
56,848 KB
testcase_12 AC 116 ms
55,968 KB
testcase_13 AC 116 ms
56,152 KB
testcase_14 AC 144 ms
56,944 KB
testcase_15 AC 115 ms
55,712 KB
testcase_16 AC 115 ms
55,868 KB
testcase_17 AC 141 ms
54,592 KB
testcase_18 AC 115 ms
55,432 KB
testcase_19 AC 113 ms
55,652 KB
testcase_20 AC 149 ms
56,704 KB
testcase_21 AC 146 ms
58,496 KB
testcase_22 AC 142 ms
57,128 KB
testcase_23 AC 118 ms
56,072 KB
testcase_24 AC 144 ms
58,696 KB
testcase_25 AC 141 ms
56,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int p = sc.nextInt();
        int q = sc.nextInt();
        int r = sc.nextInt();
        long a = sc.nextInt();
        long b = sc.nextInt();
        long c = sc.nextInt();
        long max = Math.min(Math.min(a * p, (a + b) * q), (a + b + c) * r);
        long min = Math.max(Math.max((a - 1) * p + 1, (a + b - 1) * q + 1), (a + b + c - 1) * r + 1);
        if (max < min) {
            System.out.println(-1);
        } else {
            System.out.println(min + " " + max);
        }
    }
}
0