結果
問題 | No.500 階乗電卓 |
ユーザー | Tsukasa_Type |
提出日時 | 2018-02-24 03:09:15 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 575 bytes |
コンパイル時間 | 3,738 ms |
コンパイル使用メモリ | 74,932 KB |
実行使用メモリ | 41,944 KB |
最終ジャッジ日時 | 2024-04-19 13:39:10 |
合計ジャッジ時間 | 5,135 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | AC | 130 ms
41,620 KB |
testcase_05 | AC | 111 ms
41,600 KB |
testcase_06 | AC | 111 ms
40,364 KB |
testcase_07 | AC | 94 ms
41,696 KB |
testcase_08 | AC | 117 ms
41,180 KB |
testcase_09 | AC | 134 ms
41,688 KB |
testcase_10 | AC | 100 ms
41,880 KB |
testcase_11 | AC | 111 ms
41,944 KB |
testcase_12 | AC | 110 ms
40,116 KB |
testcase_13 | AC | 109 ms
41,568 KB |
testcase_14 | AC | 100 ms
41,480 KB |
testcase_15 | AC | 101 ms
41,464 KB |
testcase_16 | AC | 113 ms
41,452 KB |
testcase_17 | AC | 113 ms
41,396 KB |
testcase_18 | AC | 100 ms
40,216 KB |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
ソースコード
import java.util.*; import static java.lang.System.*; import java.math.*; public class Main { static Scanner sc = new Scanner(System.in); public static void main(String[] args) { int n = sc.nextInt(); if (n >= 50) {out.println("000000000000");} else { BigInteger bi = new BigInteger("1"); for (int i=1; i<=n; i++) { BigInteger temp = new BigInteger(String.valueOf(i)); bi = bi.multiply(temp); } StringBuilder ans = new StringBuilder(bi.toString()); if (ans.length() > 12) { ans.delete(0,ans.length()-12); } out.println(ans); } } }