結果

問題 No.2516 Credit Creation
ユーザー yorry2101
提出日時 2024-01-11 23:15:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 1,912 ms
コンパイル使用メモリ 191,328 KB
最終ジャッジ日時 2025-02-18 17:20:29
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(void){
    cout << fixed << setprecision(16);
    int n;
    double r;
    cin >> n >> r;
    
    double sum = 100, bs = 100;
    for (int i = 0; i < n - 1; i++) {
        bs = bs * (1 - r);
        sum += bs;
    }
    cout << sum << endl;
}
0