結果

問題 No.846 メダル
ユーザー tenten
提出日時 2020-10-09 11:39:12
言語 Java
(openjdk 23)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 636 bytes
コンパイル時間 3,439 ms
コンパイル使用メモリ 86,004 KB
実行使用メモリ 55,056 KB
最終ジャッジ日時 2024-07-20 06:43:56
合計ジャッジ時間 7,749 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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