結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2018-09-14 09:07:26 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 615 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 111,496 KB |
実行使用メモリ | 25,692 KB |
最終ジャッジ日時 | 2024-07-03 23:44:16 |
合計ジャッジ時間 | 2,256 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 WA * 1 |
コンパイルメッセージ
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 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; } }