結果

問題 No.454 逆2乗和
ユーザー selpoGselpoG
提出日時 2016-12-05 01:19:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,746 bytes
コンパイル時間 2,696 ms
コンパイル使用メモリ 102,924 KB
実行使用メモリ 25,132 KB
最終ジャッジ日時 2023-08-20 03:06:45
合計ジャッジ時間 6,055 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
23,136 KB
testcase_01 AC 55 ms
25,040 KB
testcase_02 AC 53 ms
22,916 KB
testcase_03 AC 55 ms
20,932 KB
testcase_04 AC 52 ms
22,940 KB
testcase_05 AC 55 ms
23,112 KB
testcase_06 AC 54 ms
20,960 KB
testcase_07 AC 56 ms
25,084 KB
testcase_08 AC 54 ms
20,920 KB
testcase_09 AC 57 ms
23,044 KB
testcase_10 AC 56 ms
23,028 KB
testcase_11 AC 56 ms
25,120 KB
testcase_12 AC 54 ms
23,044 KB
testcase_13 AC 53 ms
22,844 KB
testcase_14 AC 52 ms
23,100 KB
testcase_15 AC 54 ms
22,996 KB
testcase_16 AC 52 ms
23,116 KB
testcase_17 AC 54 ms
23,000 KB
testcase_18 AC 54 ms
23,084 KB
testcase_19 AC 54 ms
23,068 KB
testcase_20 AC 53 ms
25,088 KB
testcase_21 AC 55 ms
22,520 KB
testcase_22 AC 54 ms
23,012 KB
testcase_23 AC 54 ms
25,008 KB
testcase_24 AC 53 ms
23,020 KB
testcase_25 AC 53 ms
23,040 KB
testcase_26 AC 56 ms
24,976 KB
testcase_27 AC 54 ms
25,132 KB
testcase_28 AC 55 ms
22,856 KB
testcase_29 AC 57 ms
23,108 KB
testcase_30 AC 53 ms
23,000 KB
testcase_31 AC 53 ms
23,044 KB
testcase_32 AC 55 ms
22,988 KB
testcase_33 AC 56 ms
24,948 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Console;
using static System.Math;
class E { static void Main() { new J(); } }
class J
{
	public J()
	{
		var x = double.Parse(ReadLine());
		WriteLine(F(x));
	}
	double F(double x)
	{
		if (x >= 1) return F(x - 1) - Pow(x, -2);
		if (0.25 <= x && x <= 0.75)
		{
			var c = new double[] {
					 0.93480220054467930942,
					-0.82879664423431999560,
					 0.70454551700121861822,
					-0.57904163777787086509,
					 0.46306452510147901007,
					-0.36214936502519405193,
					 0.27808081333064579095,
					-0.21030987302409254018,
					 0.15705320182111169910,
					-0.11604072632543951664,
					 0.084968793761035612149,
					-0.061740360184855212532,
					 0.044566556667895830656};
			return S(x - 0.5, c);
		}
		if (x < 0.25)
		{
			var c = new double[] {
					 1.4332991507927588172,
					-1.8614573783440063140,
					 2.2564383951333535169,
					-2.6012005326441520534,
					 2.8878129570405140919,
					-3.1148483803209104043,
					 3.2849880772359045144,
					-3.4031843451314309792,
					 3.4754027587225681793,
					-3.5078352416557115451,
					 3.5064489012102403649,
					-3.4767544474377607651,
					 3.4237088091689894582};
			return S(x - 0.1, c);
		}
		var d = new double[]{
				0.68797205824263561524,
				-0.45831281882901348093,
				0.29703333861218737779,
				-0.18803923871690626224,
				0.11667622240329387174,
				-0.071165764812470915838,
				0.042774406932876821967,
				-0.025387719551368310359,
				0.014905675313870900126,
				-0.0086698191289996237545,
				0.0050019637904834211830,
				-0.0028655008880623663973,
				0.0016314611646418878806 };
		return S(x - 0.9, d);
	}
	double S(double x, double[] a)
	{
		var s = 0.0;
		for (var i = a.Length - 1; i >= 0; i--) s = a[i] + x * s;
		return s;
	}
}
0