結果

問題 No.745 letinopia raoha
ユーザー htensaihtensai
提出日時 2020-02-13 18:38:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 2,354 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 41,708 KB
最終ジャッジ日時 2024-04-15 23:17:48
合計ジャッジ時間 4,371 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
41,224 KB
testcase_01 AC 138 ms
41,368 KB
testcase_02 AC 139 ms
41,236 KB
testcase_03 AC 139 ms
41,240 KB
testcase_04 AC 142 ms
41,708 KB
testcase_05 AC 142 ms
41,360 KB
testcase_06 AC 144 ms
41,228 KB
testcase_07 AC 140 ms
41,640 KB
testcase_08 AC 137 ms
41,408 KB
testcase_09 AC 141 ms
41,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		if (d >= 10) {
		    System.out.println("Impossible");
		    return;
		}
		System.out.println("Possible");
		int perfect = 100;
		int great = 50;
		long score = 0;
		while (a > 0 || b > 0) {
		    if (b > 100) {
		        score += Math.min(b, 100) * great;
		    } else {
		        score += b * great;
		        score += Math.min(a, 100 - b) * perfect;
		    }
		    b -= 100;
		    if (b < 0) {
		        a += b;
		        b = 0;
		    }
		    perfect *= 2;
		    great *= 2;
		}
		System.out.println(score);
   }
}
0