結果
問題 | No.500 階乗電卓 |
ユーザー | YamaKasa |
提出日時 | 2018-09-24 15:34:29 |
言語 | Java21 (openjdk 21) |
結果 |
RE
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 3,283 ms |
コンパイル使用メモリ | 80,672 KB |
実行使用メモリ | 57,560 KB |
最終ジャッジ日時 | 2023-10-22 02:32:11 |
合計ジャッジ時間 | 11,268 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | RE | - |
testcase_03 | RE | - |
testcase_04 | AC | 136 ms
55,304 KB |
testcase_05 | AC | 135 ms
57,284 KB |
testcase_06 | AC | 138 ms
57,476 KB |
testcase_07 | AC | 139 ms
55,548 KB |
testcase_08 | AC | 139 ms
57,208 KB |
testcase_09 | AC | 141 ms
57,532 KB |
testcase_10 | AC | 139 ms
57,468 KB |
testcase_11 | AC | 137 ms
57,344 KB |
testcase_12 | AC | 137 ms
57,260 KB |
testcase_13 | AC | 137 ms
57,308 KB |
testcase_14 | AC | 138 ms
57,316 KB |
testcase_15 | AC | 140 ms
57,372 KB |
testcase_16 | AC | 138 ms
57,332 KB |
testcase_17 | AC | 137 ms
57,560 KB |
testcase_18 | TLE | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); scan.close(); long x = 1; for(int i = 1; i <= N; i++) { x = x * i; String n = Long.toString(x); if(n.length() > 15) { x = Long.parseLong(n.substring(n.length() - 15, n.length())); } } String ans = Long.toString(x); if(ans.length() > 12) { ans = ans.substring(ans.length() - 12, ans.length()); } System.out.println(ans); } }