結果

問題 No.1273 はじめのζ関数
ユーザー Mister
提出日時 2020-10-30 21:35:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 506 bytes
コンパイル時間 572 ms
コンパイル使用メモリ 78,652 KB
最終ジャッジ日時 2025-01-15 16:51:18
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 39 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>

using ldouble = long double;
constexpr ldouble INF = 1e12;

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

    ldouble ans = 0;
    for (ldouble i = 2;; ++i) {
        if (std::pow(i, x) > INF) break;

        for (int p = x; std::pow(i, p) <= INF; ++p) {
            ans += std::pow(i, -p);
        }
    }

    std::cout << std::floor(ans * 1e6) << "\n";
}

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

    solve();

    return 0;
}
0