結果
| 問題 |
No.454 逆2乗和
|
| コンテスト | |
| ユーザー |
selpoG
|
| 提出日時 | 2016-12-05 01:19:33 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 1,746 bytes |
| コンパイル時間 | 1,021 ms |
| コンパイル使用メモリ | 111,764 KB |
| 実行使用メモリ | 19,072 KB |
| 最終ジャッジ日時 | 2024-11-30 02:30:00 |
| 合計ジャッジ時間 | 3,041 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 31 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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;
}
}
selpoG