結果
問題 | No.500 階乗電卓 |
ユーザー |
|
提出日時 | 2023-07-28 15:17:09 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 54 ms / 2,000 ms |
コード長 | 786 bytes |
コンパイル時間 | 7,163 ms |
コンパイル使用メモリ | 167,980 KB |
実行使用メモリ | 181,852 KB |
最終ジャッジ日時 | 2024-10-06 06:59:47 |
合計ジャッジ時間 | 9,153 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;using System.Collections.Generic;using System.Linq;namespace yukicoder{public class Program{public static void Main(){var n = long.Parse(Console.ReadLine());if (n < 60){Console.WriteLine(factorial(n));}else{Console.WriteLine("000000000000");}}static string factorial(long a){long f = 1;var b = (long)Math.Pow(10, 12);var c = true;while (a > 0){f *= a;if (f > b){f %= b;c = false;}a--;}if (c){return f.ToString();}else{return f.ToString("000000000000");}}}}