結果

問題 No.846 メダル
ユーザー tsunabittsunabit
提出日時 2019-08-09 15:53:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 781 bytes
コンパイル時間 3,875 ms
コンパイル使用メモリ 79,484 KB
実行使用メモリ 42,764 KB
最終ジャッジ日時 2024-04-16 10:18:03
合計ジャッジ時間 9,254 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 169 ms
42,272 KB
testcase_01 AC 143 ms
41,576 KB
testcase_02 AC 178 ms
42,648 KB
testcase_03 AC 171 ms
42,552 KB
testcase_04 AC 141 ms
41,700 KB
testcase_05 AC 146 ms
41,212 KB
testcase_06 AC 171 ms
42,724 KB
testcase_07 AC 147 ms
41,676 KB
testcase_08 AC 176 ms
42,428 KB
testcase_09 AC 180 ms
42,620 KB
testcase_10 AC 173 ms
42,260 KB
testcase_11 AC 183 ms
42,524 KB
testcase_12 AC 148 ms
41,628 KB
testcase_13 AC 145 ms
41,500 KB
testcase_14 AC 174 ms
42,452 KB
testcase_15 AC 142 ms
41,196 KB
testcase_16 AC 145 ms
41,868 KB
testcase_17 AC 174 ms
42,380 KB
testcase_18 AC 146 ms
41,324 KB
testcase_19 AC 147 ms
41,400 KB
testcase_20 AC 177 ms
42,440 KB
testcase_21 AC 171 ms
42,616 KB
testcase_22 AC 172 ms
42,204 KB
testcase_23 AC 141 ms
41,408 KB
testcase_24 AC 168 ms
42,764 KB
testcase_25 AC 183 ms
42,264 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No846 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	long p = sc.nextLong(), q = sc.nextLong(), r = sc.nextLong();
    	long a = sc.nextLong(), b = sc.nextLong(), c = sc.nextLong();
    	
    	long max = p * a;
    	long min = p * (a - 1);

    	if(max > q * (a + b)) {
    		max = q * (a + b);
    	}
    	if(min < q * (a + b - 1)) {
    		min = q * (a + b - 1);
    	}
    	
    	if(max > r * (a + b + c)) {
    		max = r * (a + b + c);
    	}
    	if(min < r * (a + b + c - 1)) {
    		min = r * (a + b + c - 1);
    	}
    	
    	if(min + 1 <= max) {
    		System.out.println((min + 1) + " " + max);
    	}else {
    		System.out.println(-1);
    	}
    }
}
0