結果
問題 | No.428 小数から逃げる夢 |
ユーザー | aketijyuuzou |
提出日時 | 2024-10-10 23:56:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 80 ms / 1,000 ms |
コード長 | 2,743 bytes |
コンパイル時間 | 915 ms |
コンパイル使用メモリ | 112,256 KB |
実行使用メモリ | 31,876 KB |
最終ジャッジ日時 | 2024-10-10 23:57:10 |
合計ジャッジ時間 | 11,077 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 75 ms
29,452 KB |
testcase_01 | AC | 77 ms
31,624 KB |
testcase_02 | AC | 76 ms
27,444 KB |
testcase_03 | AC | 76 ms
29,704 KB |
testcase_04 | AC | 77 ms
29,576 KB |
testcase_05 | AC | 78 ms
31,752 KB |
testcase_06 | AC | 76 ms
29,360 KB |
testcase_07 | AC | 76 ms
27,444 KB |
testcase_08 | AC | 76 ms
29,588 KB |
testcase_09 | AC | 75 ms
29,580 KB |
testcase_10 | AC | 75 ms
29,728 KB |
testcase_11 | AC | 76 ms
29,356 KB |
testcase_12 | AC | 77 ms
29,712 KB |
testcase_13 | AC | 76 ms
29,604 KB |
testcase_14 | AC | 76 ms
29,620 KB |
testcase_15 | AC | 76 ms
29,708 KB |
testcase_16 | AC | 78 ms
29,488 KB |
testcase_17 | AC | 78 ms
29,708 KB |
testcase_18 | AC | 77 ms
31,736 KB |
testcase_19 | AC | 78 ms
29,740 KB |
testcase_20 | AC | 77 ms
29,708 KB |
testcase_21 | AC | 77 ms
29,456 KB |
testcase_22 | AC | 76 ms
29,712 KB |
testcase_23 | AC | 76 ms
31,696 KB |
testcase_24 | AC | 77 ms
29,584 KB |
testcase_25 | AC | 76 ms
29,580 KB |
testcase_26 | AC | 76 ms
29,712 KB |
testcase_27 | AC | 77 ms
29,452 KB |
testcase_28 | AC | 77 ms
29,600 KB |
testcase_29 | AC | 76 ms
27,572 KB |
testcase_30 | AC | 76 ms
29,704 KB |
testcase_31 | AC | 76 ms
31,364 KB |
testcase_32 | AC | 75 ms
31,360 KB |
testcase_33 | AC | 77 ms
29,484 KB |
testcase_34 | AC | 76 ms
29,232 KB |
testcase_35 | AC | 76 ms
31,736 KB |
testcase_36 | AC | 77 ms
29,456 KB |
testcase_37 | AC | 75 ms
29,580 KB |
testcase_38 | AC | 75 ms
29,688 KB |
testcase_39 | AC | 75 ms
29,780 KB |
testcase_40 | AC | 75 ms
31,612 KB |
testcase_41 | AC | 78 ms
31,620 KB |
testcase_42 | AC | 75 ms
29,728 KB |
testcase_43 | AC | 80 ms
29,708 KB |
testcase_44 | AC | 76 ms
29,708 KB |
testcase_45 | AC | 78 ms
29,448 KB |
testcase_46 | AC | 77 ms
29,700 KB |
testcase_47 | AC | 76 ms
29,580 KB |
testcase_48 | AC | 76 ms
29,324 KB |
testcase_49 | AC | 76 ms
29,572 KB |
testcase_50 | AC | 77 ms
29,440 KB |
testcase_51 | AC | 75 ms
31,620 KB |
testcase_52 | AC | 76 ms
29,488 KB |
testcase_53 | AC | 77 ms
31,620 KB |
testcase_54 | AC | 77 ms
29,580 KB |
testcase_55 | AC | 77 ms
29,580 KB |
testcase_56 | AC | 78 ms
29,452 KB |
testcase_57 | AC | 77 ms
29,616 KB |
testcase_58 | AC | 77 ms
29,840 KB |
testcase_59 | AC | 77 ms
31,568 KB |
testcase_60 | AC | 80 ms
29,688 KB |
testcase_61 | AC | 77 ms
29,708 KB |
testcase_62 | AC | 77 ms
29,596 KB |
testcase_63 | AC | 76 ms
27,320 KB |
testcase_64 | AC | 76 ms
29,580 KB |
testcase_65 | AC | 77 ms
29,580 KB |
testcase_66 | AC | 78 ms
29,360 KB |
testcase_67 | AC | 77 ms
29,444 KB |
testcase_68 | AC | 76 ms
29,456 KB |
testcase_69 | AC | 76 ms
29,744 KB |
testcase_70 | AC | 75 ms
29,712 KB |
testcase_71 | AC | 76 ms
31,496 KB |
testcase_72 | AC | 76 ms
29,964 KB |
testcase_73 | AC | 76 ms
29,528 KB |
testcase_74 | AC | 76 ms
29,840 KB |
testcase_75 | AC | 76 ms
29,580 KB |
testcase_76 | AC | 76 ms
27,700 KB |
testcase_77 | AC | 77 ms
31,876 KB |
testcase_78 | AC | 77 ms
31,868 KB |
testcase_79 | AC | 76 ms
31,772 KB |
testcase_80 | AC | 77 ms
29,584 KB |
testcase_81 | AC | 77 ms
29,688 KB |
testcase_82 | AC | 76 ms
29,364 KB |
testcase_83 | AC | 76 ms
31,748 KB |
testcase_84 | AC | 76 ms
31,620 KB |
testcase_85 | AC | 76 ms
29,712 KB |
testcase_86 | AC | 78 ms
29,620 KB |
testcase_87 | AC | 76 ms
29,692 KB |
testcase_88 | AC | 77 ms
29,448 KB |
testcase_89 | AC | 77 ms
31,492 KB |
testcase_90 | AC | 76 ms
29,612 KB |
testcase_91 | AC | 75 ms
29,448 KB |
testcase_92 | AC | 75 ms
29,584 KB |
testcase_93 | AC | 75 ms
29,708 KB |
testcase_94 | AC | 75 ms
29,728 KB |
testcase_95 | AC | 75 ms
31,352 KB |
testcase_96 | AC | 76 ms
29,484 KB |
testcase_97 | AC | 76 ms
29,708 KB |
testcase_98 | AC | 77 ms
29,616 KB |
testcase_99 | AC | 75 ms
29,688 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\.)", "")); } }