結果
| 問題 |
No.1271 初めての級数
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-10-31 00:43:21 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 863 bytes |
| コンパイル時間 | 1,885 ms |
| コンパイル使用メモリ | 191,112 KB |
| 最終ジャッジ日時 | 2025-01-15 18:21:47 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
// g++ A.cpp -std=c++14 -I . && ./a.out
#include <bits/stdc++.h>
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint1000000007;
// using mint = modint998244353;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, a, b) for (int i = a; i < (int)(b); i++)
#define rrep(i, a, b) for (int i = a; i > (int)(b); i--)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll INF = 1e18;
const long double PI = 3.1415926535897932;
// 変数定義
ll N, M, Q, a, b, c, d, e, x, y, t, T, total, cnt;
float ans;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> N;
cout << fixed << setprecision(10);
if (N == 0)
{
ans = PI * PI / 6;
cout << ans << '\n';
return 0;
}
rep(i, N)
{
ans += 1.0 / (i + 1);
}
ans /= N;
cout << ans << '\n';
return 0;
}