結果

問題 No.2516 Credit Creation
ユーザー forest3
提出日時 2024-01-13 17:35:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 330 bytes
コンパイル時間 1,473 ms
コンパイル使用メモリ 165,844 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-28 01:36:16
合計ジャッジ時間 2,433 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
	int N;
	double r;
	cin >> N >> r;
	double x = 100, ans = 0;
	rep(i, N) {
		if( i + 1 < N) {
			ans += x;
			x = (1 - r) * x;
		}
		else ans += x;
	}
	cout << fixed << setprecision(12) << ans << endl;
}
0