結果

問題 No.454 逆2乗和
ユーザー はむ吉🐹
提出日時 2017-01-02 13:41:30
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 3,909 ms
コンパイル使用メモリ 148,468 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 06:13:53
合計ジャッジ時間 4,294 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.conv;
import std.mathspecial;
import std.stdio;
import std.string;


const real H = 1e-6;


template sevenPointDiff(alias f){
	T sevenPointDiff(T)(T x, T h=H){
		T res;
		res = f(x + 3 * h) / 60 - 3 * f(x + 2 * h) / 20;
		res += 3 * f(x + h) / 4 - 3 * f (x - h) / 4;
		res += 3 * f(x - 2 * h) / 20 - f(x - 3 * h) / 60;
		res /= h;
		return res;
	}
}


void main(){
	auto x = readln.chomp.to!real;
	writefln("%.12f", sevenPointDiff!(digamma)(x + 1));
}
0