結果

問題 No.3362 積分!!!
コンテスト
ユーザー AK_Mi
提出日時 2025-11-17 23:51:28
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 4,899 ms
コンパイル使用メモリ 335,860 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-11-17 23:51:38
合計ジャッジ時間 5,660 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using ld = long double;
int main(){
    ld n,a,b;
    cin >> n >> a >> b;
    ld ans = 0;
    vector<ld> aa(n+2,1);
    vector<ld> bb(n+2,1);

    for(ll i = 1; i < n+2; i++){
        aa[i] = aa[i-1] * a;
        bb[i] = bb[i-1] * b;
    }
    ld k;

    for(ll i = 0; i <= n; i++){
        cin >> k;
        ans += k * (bb[i+1] - aa[i+1]) / (i+1);
    }
    

    if(ans < 0){
        if(ans - ll(ans) == 0)cout << ans << '\n';
        else cout << ll(ans) - 1 << '\n';
    }else cout << ll(ans) << '\n';


    return 0;
}
0