結果

問題 No.1271 初めての級数
ユーザー Re_menal2
提出日時 2020-10-30 23:37:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 296 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 67,620 KB
実行使用メモリ 6,816 KB
最終ジャッジ日時 2024-07-22 03:15:51
合計ジャッジ時間 1,508 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#define _USE_MATH_DEFINES
#include <cmath>
int main(){
	int k;
	float cnt = 0;
	float ans;
	std::cin >> k;
	if (k == 0) {
	    ans = (M_PI * M_PI)/6;
	}
	else {
	    for (int i = 1; i <= k; i++) {
		cnt = cnt + (1./i);
	    }
	    ans = cnt/k;
	}
	
	std::cout << ans << "\n";
}
0