結果
| 問題 | No.1271 初めての級数 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-30 03:30:33 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 390µs | |
| コード長 | 345 bytes |
| 記録 | |
| コンパイル時間 | 3,092 ms |
| コンパイル使用メモリ | 187,444 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-08-30 03:30:38 |
| 合計ジャッジ時間 | 4,096 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
ソースコード
#include<iostream>
#include<vector>
#include<math.h>
#include<algorithm>
using namespace std;
using ll = long long;
int main(void){
int k; cin >> k;
if(k==0){
double PI=atan2(1, 1)*4.0;
printf("%.10f\n", PI*PI/6);
}
else{
double ans=0;
for(int i=1; i<=k; i++) ans+=1.0/i;
printf("%.10f\n", ans/k);
}
return 0;
}