結果

問題 No.500 階乗電卓
ユーザー bluemeganebluemegane
提出日時 2018-09-14 08:51:42
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 522 bytes
コンパイル時間 2,550 ms
コンパイル使用メモリ 102,172 KB
実行使用メモリ 24,436 KB
最終ジャッジ日時 2023-09-17 00:19:03
合計ジャッジ時間 5,224 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 AC 54 ms
20,624 KB
testcase_05 AC 56 ms
22,736 KB
testcase_06 AC 56 ms
20,880 KB
testcase_07 AC 56 ms
20,620 KB
testcase_08 AC 55 ms
22,660 KB
testcase_09 AC 56 ms
22,660 KB
testcase_10 AC 54 ms
20,624 KB
testcase_11 AC 57 ms
20,836 KB
testcase_12 AC 55 ms
18,672 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 56 ms
20,724 KB
testcase_16 AC 53 ms
22,836 KB
testcase_17 AC 54 ms
22,804 KB
testcase_18 AC 54 ms
20,696 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        if (n >= 50) Console.WriteLine(new string('0', 12));
        else Console.WriteLine(getAns(n));
    }
    public static long getAns(int n)
    {
        var ans = 1L;
        for (int i = 2; i <= n; i++)
        {
            ans *= i;
            var t = ans.ToString();
            if (t.Length >= 13) ans = long.Parse(t.Substring(t.Length - 12));
        }
        return ans;
    }
}
0