結果

問題 No.1271 初めての級数
ユーザー ytqm3ytqm3
提出日時 2021-05-19 20:01:10
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 291 bytes
コンパイル時間 2,189 ms
コンパイル使用メモリ 193,580 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-18 08:26:36
合計ジャッジ時間 3,071 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long double f64;

int main()
{
  cout<<fixed<<setprecision(10);
  f64 k;
  cin>>k;
  if(k==0)
  {
    cout<<acos(-1)/6<<endl;
    return 0;
  }
  f64 sum=0;
  for(f64 i=1;i<=k;i+=1)
  {
    sum+=1/i;
  }
  cout<<sum/k<<endl;
  return 0;
}
0