結果

問題 No.2516 Credit Creation
ユーザー ks2mks2m
提出日時 2023-10-27 21:26:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 2,598 ms
コンパイル使用メモリ 74,104 KB
実行使用メモリ 57,824 KB
最終ジャッジ日時 2023-10-27 21:26:21
合計ジャッジ時間 5,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,824 KB
testcase_01 AC 124 ms
56,992 KB
testcase_02 AC 130 ms
57,324 KB
testcase_03 AC 134 ms
57,372 KB
testcase_04 AC 134 ms
57,588 KB
testcase_05 AC 130 ms
57,624 KB
testcase_06 AC 133 ms
57,716 KB
testcase_07 AC 131 ms
57,752 KB
testcase_08 AC 132 ms
55,680 KB
testcase_09 AC 136 ms
57,180 KB
testcase_10 AC 133 ms
57,448 KB
testcase_11 AC 130 ms
56,604 KB
testcase_12 AC 131 ms
57,636 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		double r = sc.nextDouble();
		sc.close();

		double ans = 0;
		double x = 100;
		for (int i = 0; i < n; i++) {
			ans += x;
			x *= (1 - r);
		}
		System.out.println(ans);
	}
}
0