結果

問題 No.745 letinopia raoha
ユーザー htensai
提出日時 2020-02-13 18:38:39
言語 Java
(openjdk 23)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 2,460 ms
コンパイル使用メモリ 74,364 KB
実行使用メモリ 41,244 KB
最終ジャッジ日時 2024-10-06 06:17:41
合計ジャッジ時間 4,663 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

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