結果
問題 |
No.1271 初めての級数
|
ユーザー |
👑 |
提出日時 | 2022-08-09 19:38:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 403 bytes |
コンパイル時間 | 1,187 ms |
コンパイル使用メモリ | 88,568 KB |
最終ジャッジ日時 | 2025-01-30 19:46:53 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 WA * 1 |
ソースコード
#include <iostream> #include <iomanip> #include <cmath> using namespace std; int main(){ int n;cin>>n; if(n==0){ cout << fixed << setprecision(10) << (double)6/(double)acos(-1)*acos(-1) << endl; return 0; } double ans = 0; for(int i = 1; n >= i; i++){ ans += (double)1/(double)i; } cout << fixed << setprecision(10) << (double)ans/(double)n << endl; }