結果

問題 No.2269 eN!の整数部分の下1桁
ユーザー 👑 kakel-sankakel-san
提出日時 2023-07-05 18:07:37
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 842 bytes
コンパイル時間 1,586 ms
コンパイル使用メモリ 65,404 KB
実行使用メモリ 28,104 KB
最終ジャッジ日時 2023-09-26 18:25:51
合計ジャッジ時間 5,184 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,696 KB
testcase_01 AC 57 ms
20,680 KB
testcase_02 AC 57 ms
22,756 KB
testcase_03 AC 57 ms
20,756 KB
testcase_04 AC 58 ms
20,756 KB
testcase_05 AC 58 ms
22,720 KB
testcase_06 AC 57 ms
18,668 KB
testcase_07 AC 59 ms
20,660 KB
testcase_08 AC 57 ms
18,632 KB
testcase_09 AC 58 ms
20,692 KB
testcase_10 AC 58 ms
22,808 KB
testcase_11 AC 57 ms
20,728 KB
testcase_12 AC 58 ms
22,780 KB
testcase_13 AC 59 ms
20,640 KB
testcase_14 AC 58 ms
22,664 KB
testcase_15 AC 58 ms
20,852 KB
testcase_16 AC 59 ms
20,752 KB
testcase_17 AC 64 ms
20,688 KB
testcase_18 AC 123 ms
28,104 KB
testcase_19 AC 122 ms
26,168 KB
testcase_20 AC 123 ms
28,024 KB
testcase_21 AC 119 ms
26,004 KB
testcase_22 AC 109 ms
28,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static ulong NN => ulong.Parse(ReadLine());
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = (int)NN;
        var ans = new ulong[t];
        for (var u = 0; u < t; ++u)
        {
            var n = NN;
            if (n == 0)
            {
                ans[u] = 2;
                continue;
            }
            ulong mul = 1;
            ulong en1 = 0;
            for (ulong i = 0; i <= n; ++i)
            {
                en1 += mul;
                mul = mul * (n - i) % 10;
                if (mul == 0) break;
            }
            ans[u] = en1 % 10;
        }
        WriteLine(string.Join("\n", ans));
    }
}
0