結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2018-09-14 08:51:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 522 bytes |
コンパイル時間 | 1,729 ms |
コンパイル使用メモリ | 105,888 KB |
実行使用メモリ | 25,700 KB |
最終ジャッジ日時 | 2024-07-03 22:48:40 |
合計ジャッジ時間 | 2,058 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 WA * 2 RE * 8 |
コンパイルメッセージ
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 = 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; } }