結果
| 問題 |
No.1273 はじめのζ関数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-30 22:35:17 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,558 bytes |
| コンパイル時間 | 2,034 ms |
| コンパイル使用メモリ | 193,248 KB |
| 最終ジャッジ日時 | 2025-01-15 17:37:24 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 39 WA * 1 |
ソースコード
#include "bits/stdc++.h"
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++) // [0, b)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); i++) // [a, b)
#define rep3(i, a, b) // reversed [a, b] so [b, b-1, ... a]
#define FOR(i, a) for (auto &i: a)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define SUM(x) accumulate(ALL(x), 0LL)
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
using namespace std;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);
const double EPS = 1e-14;
const double PI = acos(-1);
int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); } //always return positive num
int pow_mod(int a, int b) { //return x^y in order(log(y))
int res = 1;
for (a %= MOD; b; a = a * a % MOD, b >>= 1)
if (b & 1) res = res * a % MOD;
return res;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
int x;
cin >> x;
if (x == 1){
cout<<1000000<<endl;
return 0;
}
double ans = -10000;
rep2(i, x, x + 10000) {
double zeta = 0;
rep2(j, 1, 1000) {
zeta += 1 / pow(j, i);
}
ans += zeta;
}
cout << (int)floor(ans * pow(10, 6)) << endl;
}