結果
| 問題 |
No.2829 GCD Divination
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-08-02 22:29:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 606 bytes |
| コンパイル時間 | 4,282 ms |
| コンパイル使用メモリ | 256,392 KB |
| 最終ジャッジ日時 | 2025-02-23 20:10:25 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 30 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using ll = long long;
#define MOD 1000000007
#define Mod 998244353
const int MAX = 1000000005;
const long long INF = 1000000000000000005LL;
using namespace std;
using namespace atcoder;
int N;
map<int, double> dp;
double rec(int n) {
if (dp.count(n)) return dp[n];
if (n == 1) return 0;
double s = 0;
for (int m = 2; m*m <= n; m++) {
if (n % m == 0) s += rec(m);
}
return dp[n] = (n + s)/(n - 1);
}
int main() {
ios::sync_with_stdio(0);cin.tie();
cin >> N;
cout << fixed << setprecision(12) << rec(N) << endl;
}