結果
問題 | No.500 階乗電卓 |
ユーザー | 14番 |
提出日時 | 2017-06-04 06:50:22 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 1,203 bytes |
コンパイル時間 | 2,125 ms |
コンパイル使用メモリ | 102,380 KB |
実行使用メモリ | 23,172 KB |
最終ジャッジ日時 | 2023-09-07 08:41:58 |
合計ジャッジ時間 | 4,631 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 61 ms
21,044 KB |
testcase_01 | AC | 61 ms
21,012 KB |
testcase_02 | AC | 60 ms
21,040 KB |
testcase_03 | AC | 60 ms
23,172 KB |
testcase_04 | AC | 57 ms
20,800 KB |
testcase_05 | AC | 56 ms
22,812 KB |
testcase_06 | AC | 61 ms
21,088 KB |
testcase_07 | AC | 58 ms
22,796 KB |
testcase_08 | AC | 55 ms
20,772 KB |
testcase_09 | AC | 57 ms
20,808 KB |
testcase_10 | AC | 55 ms
20,684 KB |
testcase_11 | AC | 59 ms
19,004 KB |
testcase_12 | AC | 60 ms
21,152 KB |
testcase_13 | AC | 60 ms
21,048 KB |
testcase_14 | AC | 60 ms
21,156 KB |
testcase_15 | AC | 59 ms
18,968 KB |
testcase_16 | AC | 60 ms
23,140 KB |
testcase_17 | AC | 59 ms
21,116 KB |
testcase_18 | AC | 60 ms
21,024 KB |
testcase_19 | AC | 59 ms
18,964 KB |
testcase_20 | AC | 60 ms
21,120 KB |
testcase_21 | AC | 59 ms
21,132 KB |
testcase_22 | AC | 60 ms
21,208 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.IO; using System.Linq; using System.Collections.Generic; public class Program { public void Proc() { long inpt = long.Parse(Reader.ReadLine()); long ans = 1; long mod = 1000000000000; bool mustFillZero = false; for (int i = 1; i <= inpt; i++) { ans = ans * i; if(ans >= mod) { mustFillZero = true; } ans = ans % mod; if(ans == 0) { break; } } string strAns = ans.ToString(); if (mustFillZero) { strAns = ans.ToString("000000000000"); } Console.WriteLine(strAns); } public class Reader { private static StringReader sr; public static bool IsDebug = false; public static string ReadLine() { if (IsDebug) { if (sr == null) { sr = new StringReader(InputText.Trim()); } return sr.ReadLine(); } else { return Console.ReadLine(); } } private static string InputText = @" 50 "; } public static void Main(string[] args) { #if DEBUG Reader.IsDebug = true; #endif Program prg = new Program(); prg.Proc(); } }