結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2018-09-14 09:10:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 663 bytes |
コンパイル時間 | 798 ms |
コンパイル使用メモリ | 110,752 KB |
実行使用メモリ | 25,816 KB |
最終ジャッジ日時 | 2024-07-04 00:00:20 |
合計ジャッジ時間 | 2,183 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; public class Hello { public static void Main() { var n = long.Parse(Console.ReadLine().Trim()); if (n >= 50) Console.WriteLine(new string('0', 12)); else if (n == 1) Console.WriteLine(1); else Console.WriteLine(getAns((int)n)); } public static string getAns(int n) { var ansnum = 1L; var t = ""; for (int i = 2; i <= n; i++) { ansnum *= i; t = ansnum.ToString(); if (t.Length >= 13) { t = t.Substring(t.Length - 12); ansnum = long.Parse(t); } } return t; } }