結果

問題 No.1272 珍しい級数
ユーザー Mister
提出日時 2020-10-30 21:30:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 452 bytes
コンパイル時間 650 ms
コンパイル使用メモリ 89,232 KB
最終ジャッジ日時 2025-01-15 16:43:41
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <cmath>

using ldouble = long double;

void solve() {
    int k;
    std::cin >> k;

    ldouble ans = 0;
    for (int n = 20; n >= 1; --n) {
        ans += std::sin(n * k) / std::pow(ldouble(n), n);
    }

    std::cout << ans << "\n";
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    std::cout << std::fixed << std::setprecision(10);

    solve();

    return 0;
}
0