結果
問題 | No.500 階乗電卓 |
ユーザー | Tsukasa_Type |
提出日時 | 2018-02-24 03:08:01 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 1,934 ms |
コンパイル使用メモリ | 75,692 KB |
実行使用メモリ | 54,536 KB |
最終ジャッジ日時 | 2024-04-19 13:38:36 |
合計ジャッジ時間 | 5,453 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 115 ms
40,148 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 110 ms
40,068 KB |
testcase_12 | AC | 104 ms
41,304 KB |
testcase_13 | AC | 115 ms
40,108 KB |
testcase_14 | AC | 114 ms
41,500 KB |
testcase_15 | AC | 106 ms
40,420 KB |
testcase_16 | AC | 100 ms
41,440 KB |
testcase_17 | AC | 104 ms
40,036 KB |
testcase_18 | AC | 98 ms
41,596 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) { while (ans.length() < 12) { ans.insert(0,"0"); } } else if (ans.length() > 12) { ans.delete(0,ans.length()-12); } out.println(ans); } } }