結果
問題 | No.1273 はじめのζ関数 |
ユーザー |
|
提出日時 | 2020-11-01 02:27:17 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 1,759 ms |
コンパイル使用メモリ | 194,056 KB |
最終ジャッジ日時 | 2025-01-15 18:43:03 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 40 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0; i<(int)(n); i++) const double EPS = 1e-18; const double PI = acos(-1); double calc(int x) { if (x == 2) return pow(PI, 2) / 6.0 - 1.0; double ret = 0; for (int i = 2; ; i++) { double tmp = pow(1.0/i, x); if (tmp < EPS) break; ret += tmp; } return ret; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); double ret = 0; int x; cin >> x; for (int i = x; ; i++) { if (pow(1.0/2, i) < EPS) break; ret += calc(i); } cout << int((ret + 1e-9) * 1e6) << endl; return 0; }