結果
| 問題 |
No.1235 ζ関数
|
| ユーザー |
YamaKasa
|
| 提出日時 | 2020-10-04 20:02:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 399 bytes |
| コンパイル時間 | 1,222 ms |
| コンパイル使用メモリ | 163,100 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-20 10:42:24 |
| 合計ジャッジ時間 | 1,991 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// 累乗
double my_pow(double x, ll n) {
if (n == 0) return 1;
if (n % 2 == 0) return my_pow(x * x, n / 2);
return x * my_pow(x, n - 1);
}
int main() {
int N;
cin >> N;
double s = 1;
for (int i = 2; i < 10; i++) {
s += my_pow((double)1 / i, N);
}
printf("%.9f\n", s);
return 0;
}
YamaKasa