結果
問題 | No.454 逆2乗和 |
ユーザー |
![]() |
提出日時 | 2016-12-05 14:15:37 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 3,180 bytes |
コンパイル時間 | 1,489 ms |
コンパイル使用メモリ | 111,000 KB |
実行使用メモリ | 22,452 KB |
最終ジャッジ日時 | 2024-11-30 02:45:02 |
合計ジャッジ時間 | 2,865 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 = decimal.Parse(ReadLine());WriteLine("{0:f30}", F(x));}decimal F(decimal x){var s = 0m;while (x >= 1) { s -= 1 / (x * x); x--; }var c = new decimal[] {0.934802200544679309417245499938m, -0.828796644234319995596334261160m,0.704545517001218618220166344353m, -0.579041637777870865089320320672m,0.463064525101479010073147884140m, -0.362149365025194051925732985545m,0.278080813330645790953150737945m, -0.210309873024092540182120622101m,0.157053201821111699102843595237m, -0.116040726325439516635723316840m,0.0849687937610356121486220604335m, -0.0617403601848552125315158487211m,0.0445665566678958306556779466182m, -0.0319863470099671709328335162947m,0.0228430551900062099110866340887m, -0.0162421055545558554090252415968m,0.0115040422365013313712234041955m, -0.00812016943046959528636976736546m,0.00571405369517650261958028746006m, -0.00400980350070223863383270061075m,0.00280683779121192659670361349559m, -0.00196032082598494370720627822094m,0.00136627989340513565859899322380m, -0.000950453775778187902602080505409m,0.000660036593451655151214331603647m, -0.000457625059139312543832780856133m,0.000316817218910202975530282277437m, -0.000219034072844732759935058022801m,0.000151237789910656222955212455099m, -0.000104301914852397820298442191236m,0.0000718524264191639058262780448723m, -0.0000494468295099862202971767811052m,0.0000339946946387761628180435201757m, -0.0000233498909994332923045440869638m,0.0000160244348894213221089962742765m, -0.0000109881838788395471852956277851m,0.00000752894078723383082806955951400m, -0.00000515495044126029632563349825079m,0.00000352707135140330242690462657687m, -0.00000241167271761871746973984769064m,0.00000164797635651075260851723994579m, -0.00000112544726764436204898458979840m,0.000000768162420684416899557407425635m, -0.000000524017775314297050883382225887m,0.000000357284846790347248585058118809m, -0.000000243483006695495816041148953475m,0.000000165850743688652348310398405047m, -0.000000112919655276366201633473176983m,0.0000000768480987293351213191380458419m, -0.0000000522776181830521508734450986940m,0.0000000355487803644065023978151140218m, -0.0000000241638768489802165568390156209m,0.0000000164190445255776551840460267393m, -0.0000000111525585456707153596406861955m,0.00000000757272493841648313038909070149m, -0.00000000514027389759101922671384908793m,0.00000000348804300193644735504757154867m, -0.00000000236615782587488842717335050584m,0.00000000160463576697257320212655829721m, -0.00000000108788865557460463209883475313m,0.000000000737346755445001157356813691020m, -0.000000000499622938115734972886821035223m,0.000000000338454248400980326640613846856m, -0.000000000229217692038758582267292215300m,0.000000000155199478984575887481037931931m, -0.000000000105058108851097428009803428715m};return s + S(x - 0.5m, c);}decimal S(decimal x, decimal[] a){var s = 0m;for (var i = a.Length - 1; i >= 0; i--) s = a[i] + x * s;return s;}}