結果
問題 | No.428 小数から逃げる夢 |
ユーザー | 明智重蔵 |
提出日時 | 2016-10-07 19:41:07 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 76 ms / 1,000 ms |
コード長 | 2,743 bytes |
コンパイル時間 | 3,492 ms |
コンパイル使用メモリ | 113,828 KB |
実行使用メモリ | 23,936 KB |
最終ジャッジ日時 | 2024-05-01 15:01:49 |
合計ジャッジ時間 | 11,321 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 74 ms
23,808 KB |
testcase_01 | AC | 74 ms
23,680 KB |
testcase_02 | AC | 75 ms
23,808 KB |
testcase_03 | AC | 74 ms
23,552 KB |
testcase_04 | AC | 73 ms
23,424 KB |
testcase_05 | AC | 75 ms
23,168 KB |
testcase_06 | AC | 75 ms
23,808 KB |
testcase_07 | AC | 75 ms
23,296 KB |
testcase_08 | AC | 75 ms
23,296 KB |
testcase_09 | AC | 75 ms
23,680 KB |
testcase_10 | AC | 73 ms
23,424 KB |
testcase_11 | AC | 74 ms
23,552 KB |
testcase_12 | AC | 74 ms
23,296 KB |
testcase_13 | AC | 73 ms
23,552 KB |
testcase_14 | AC | 73 ms
23,680 KB |
testcase_15 | AC | 73 ms
23,296 KB |
testcase_16 | AC | 73 ms
23,296 KB |
testcase_17 | AC | 74 ms
23,680 KB |
testcase_18 | AC | 73 ms
23,680 KB |
testcase_19 | AC | 73 ms
23,168 KB |
testcase_20 | AC | 74 ms
23,296 KB |
testcase_21 | AC | 73 ms
23,552 KB |
testcase_22 | AC | 74 ms
23,680 KB |
testcase_23 | AC | 74 ms
23,552 KB |
testcase_24 | AC | 74 ms
23,808 KB |
testcase_25 | AC | 74 ms
23,936 KB |
testcase_26 | AC | 74 ms
23,680 KB |
testcase_27 | AC | 74 ms
23,296 KB |
testcase_28 | AC | 74 ms
23,424 KB |
testcase_29 | AC | 74 ms
23,808 KB |
testcase_30 | AC | 75 ms
23,168 KB |
testcase_31 | AC | 74 ms
23,680 KB |
testcase_32 | AC | 74 ms
23,168 KB |
testcase_33 | AC | 74 ms
23,552 KB |
testcase_34 | AC | 73 ms
23,680 KB |
testcase_35 | AC | 74 ms
23,424 KB |
testcase_36 | AC | 74 ms
23,552 KB |
testcase_37 | AC | 75 ms
23,296 KB |
testcase_38 | AC | 73 ms
23,680 KB |
testcase_39 | AC | 74 ms
22,912 KB |
testcase_40 | AC | 73 ms
23,552 KB |
testcase_41 | AC | 75 ms
23,296 KB |
testcase_42 | AC | 75 ms
23,296 KB |
testcase_43 | AC | 74 ms
23,296 KB |
testcase_44 | AC | 73 ms
23,424 KB |
testcase_45 | AC | 73 ms
23,168 KB |
testcase_46 | AC | 74 ms
23,936 KB |
testcase_47 | AC | 72 ms
23,808 KB |
testcase_48 | AC | 73 ms
23,296 KB |
testcase_49 | AC | 74 ms
23,680 KB |
testcase_50 | AC | 75 ms
23,168 KB |
testcase_51 | AC | 73 ms
23,424 KB |
testcase_52 | AC | 72 ms
23,424 KB |
testcase_53 | AC | 73 ms
23,552 KB |
testcase_54 | AC | 73 ms
23,168 KB |
testcase_55 | AC | 74 ms
23,424 KB |
testcase_56 | AC | 73 ms
23,296 KB |
testcase_57 | AC | 73 ms
23,552 KB |
testcase_58 | AC | 73 ms
23,680 KB |
testcase_59 | AC | 73 ms
23,424 KB |
testcase_60 | AC | 73 ms
23,552 KB |
testcase_61 | AC | 73 ms
23,424 KB |
testcase_62 | AC | 76 ms
23,680 KB |
testcase_63 | AC | 74 ms
23,168 KB |
testcase_64 | AC | 74 ms
23,552 KB |
testcase_65 | AC | 73 ms
23,552 KB |
testcase_66 | AC | 73 ms
23,424 KB |
testcase_67 | AC | 72 ms
23,552 KB |
testcase_68 | AC | 73 ms
23,296 KB |
testcase_69 | AC | 73 ms
23,680 KB |
testcase_70 | AC | 73 ms
23,680 KB |
testcase_71 | AC | 73 ms
23,808 KB |
testcase_72 | AC | 74 ms
23,680 KB |
testcase_73 | AC | 75 ms
23,680 KB |
testcase_74 | AC | 75 ms
23,552 KB |
testcase_75 | AC | 75 ms
23,680 KB |
testcase_76 | AC | 73 ms
23,424 KB |
testcase_77 | AC | 73 ms
23,552 KB |
testcase_78 | AC | 74 ms
23,680 KB |
testcase_79 | AC | 73 ms
23,808 KB |
testcase_80 | AC | 74 ms
23,424 KB |
testcase_81 | AC | 74 ms
23,552 KB |
testcase_82 | AC | 73 ms
23,040 KB |
testcase_83 | AC | 74 ms
23,808 KB |
testcase_84 | AC | 75 ms
23,680 KB |
testcase_85 | AC | 74 ms
23,424 KB |
testcase_86 | AC | 74 ms
23,680 KB |
testcase_87 | AC | 74 ms
23,424 KB |
testcase_88 | AC | 73 ms
23,296 KB |
testcase_89 | AC | 74 ms
23,808 KB |
testcase_90 | AC | 75 ms
23,552 KB |
testcase_91 | AC | 73 ms
23,680 KB |
testcase_92 | AC | 74 ms
23,808 KB |
testcase_93 | AC | 73 ms
23,168 KB |
testcase_94 | AC | 74 ms
23,424 KB |
testcase_95 | AC | 75 ms
23,552 KB |
testcase_96 | AC | 74 ms
23,296 KB |
testcase_97 | AC | 73 ms
23,424 KB |
testcase_98 | AC | 74 ms
23,424 KB |
testcase_99 | AC | 74 ms
23,296 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; class Program { static string InputPattern = "InputX"; static List<string> GetInputList() { var WillReturn = new List<string>(); if (InputPattern == "Input1") { WillReturn.Add("1"); //0.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991 //1倍しても値は変わりません } else if (InputPattern == "Input2") { WillReturn.Add("10"); //1.2345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910 //Dを10倍にして、小数点以下189桁までで誤差なく表示していますが、 //末尾に0がついていても正しい値です。 } else if (InputPattern == "Input3") { WillReturn.Add("14"); //1.7283950474155698398122640546882971125395367819610243852668095092337516579940822365064789307213549637792062034486276910519334761759004183246607489031731455973880216304458728701152943577185874 } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List<string> InputList = GetInputList(); string D = "0.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991"; int N = int.Parse(InputList[0]); //整数部10桁、小数部190桁の配列 int[] NumArr = new int[10 + 190]; int UB = NumArr.GetUpperBound(0); int CurrInd = 10; foreach (char EachChar in D.Skip(2)) { NumArr[CurrInd] = EachChar - '0'; CurrInd++; } //掛け算の処理 for (int I = 0; I <= UB; I++) NumArr[I] *= N; //繰り上げ処理 for (int I = UB; 0 <= I; I--) { if (NumArr[I] > 9) { NumArr[I - 1] += NumArr[I] / 10; NumArr[I] %= 10; } } var sb = new System.Text.StringBuilder(); for (int I = 0; I <= NumArr.GetUpperBound(0); I++) { sb.Append(NumArr[I]); if (I == 9) sb.Append('.'); } Console.WriteLine(Regex.Replace(sb.ToString(), @"^0+(?=[1-9]|0\.)", "")); } }