結果
| 問題 | No.1271 初めての級数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-07 20:37:21 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 241 bytes |
| コンパイル時間 | 597 ms |
| コンパイル使用メモリ | 74,344 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-22 14:45:47 |
| 合計ジャッジ時間 | 1,114 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int K;
main()
{
cin>>K;
double ans=0;
if(K==0)ans=M_PI*M_PI/6;
else
{
for(int N=1;N<=K;N++)ans+=1./N;
ans/=K;
}
cout<<fixed<<setprecision(16)<<ans<<endl;
}