結果

問題 No.1271 初めての級数
ユーザー tadanoningen
提出日時 2020-10-30 21:44:51
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 933 ms
コンパイル使用メモリ 75,820 KB
最終ジャッジ日時 2025-01-15 17:03:26
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<iomanip>
#define ll long long

using namespace std;

int main(){
    cout << fixed << setprecision(15);
    int n;
    cin >> n;
    long double sum = 0;
    for(int i = 1;i <= n;i++){
        long double x = 1/(long double)i;
        sum += x;
    }
    sum /= (long double)n;
    cout << sum << endl;
    return 0;
}
0