結果

問題 No.846 メダル
ユーザー GrenacheGrenache
提出日時 2019-07-05 22:32:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 1,054 bytes
コンパイル時間 4,620 ms
コンパイル使用メモリ 77,660 KB
実行使用メモリ 54,324 KB
最終ジャッジ日時 2024-04-16 07:49:22
合計ジャッジ時間 9,697 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 144 ms
54,256 KB
testcase_01 AC 141 ms
53,904 KB
testcase_02 AC 142 ms
54,040 KB
testcase_03 AC 143 ms
54,264 KB
testcase_04 AC 142 ms
54,032 KB
testcase_05 AC 142 ms
53,804 KB
testcase_06 AC 142 ms
54,252 KB
testcase_07 AC 144 ms
54,100 KB
testcase_08 AC 143 ms
54,004 KB
testcase_09 AC 144 ms
54,324 KB
testcase_10 AC 146 ms
54,132 KB
testcase_11 AC 145 ms
54,120 KB
testcase_12 AC 145 ms
53,936 KB
testcase_13 AC 143 ms
54,172 KB
testcase_14 AC 146 ms
53,932 KB
testcase_15 AC 143 ms
54,000 KB
testcase_16 AC 144 ms
53,840 KB
testcase_17 AC 145 ms
54,324 KB
testcase_18 AC 143 ms
54,280 KB
testcase_19 AC 145 ms
54,136 KB
testcase_20 AC 145 ms
53,780 KB
testcase_21 AC 145 ms
53,920 KB
testcase_22 AC 144 ms
54,176 KB
testcase_23 AC 140 ms
53,960 KB
testcase_24 AC 141 ms
54,064 KB
testcase_25 AC 146 ms
54,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.Scanner;


public class Main_yukicoder846 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		long p = sc.nextInt();
		long q = sc.nextInt();
		long r = sc.nextInt();
		long a = sc.nextInt();
		long b = sc.nextInt();
		long c = sc.nextInt();

		long min = p * a - (p - 1);
		long max = p * a;
//		pr.printf("%d %d%n", min, max);
		min = Math.max(min, q * (a + b) - (q - 1));
		max = Math.min(max, q * (a + b));
//		pr.printf("%d %d%n", min, max);
		min = Math.max(min, r * (a + b + c) - (r - 1));
		max = Math.min(max, r * (a + b + c));
//		pr.printf("%d %d%n", min, max);
		
		if (min > max) {
			pr.println(-1);
		} else {
			pr.printf("%d %d%n", min, max);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0