結果
| 問題 |
No.428 小数から逃げる夢
|
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-09-16 16:51:54 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 1,000 ms |
| コード長 | 817 bytes |
| コンパイル時間 | 793 ms |
| コンパイル使用メモリ | 103,936 KB |
| 実行使用メモリ | 18,816 KB |
| 最終ジャッジ日時 | 2024-07-18 07:24:23 |
| 合計ジャッジ時間 | 5,898 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 100 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Numerics;
public class Hello
{
public static void Main()
{
var s = "";
for (int i = 1; i <= 99; i++) s += i.ToString();
s += "1";
var n = int.Parse(Console.ReadLine().Trim());
BigInteger a = BigInteger.Parse(s) * n;
var s2 = a.ToString();
writeAns(s2, getK(n));
}
public static void writeAns(string s, int n)
{
var ans = "";
if (n == 0) ans = "0." + s;
else ans = s.Substring(0, n) + "." + s.Substring(n);
Console.WriteLine(ans);
}
public static int getK(int n)
{
var s = 0.12345d;
var a = s * n;
if (a >= 100) return 3;
else if (a >= 10 && a < 100) return 2;
else if (a >= 1 && a < 10) return 1;
else return 0;
}
}
bluemegane