結果
問題 |
No.500 階乗電卓
|
ユーザー |
![]() |
提出日時 | 2018-09-14 09:14:06 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 631 bytes |
コンパイル時間 | 771 ms |
コンパイル使用メモリ | 108,704 KB |
実行使用メモリ | 26,096 KB |
最終ジャッジ日時 | 2024-07-04 01:27:42 |
合計ジャッジ時間 | 1,995 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 7 |
コンパイルメッセージ
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()); Console.WriteLine(getAns((int)n)); } public static string getAns(int n) { if (n == 1) return "1"; if (n >= 50) return new string('0', 12); 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; } }