結果
| 問題 |
No.500 階乗電卓
|
| コンテスト | |
| ユーザー |
uafr_cs
|
| 提出日時 | 2017-04-07 22:41:20 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 757 bytes |
| コンパイル時間 | 2,108 ms |
| コンパイル使用メモリ | 80,940 KB |
| 実行使用メモリ | 41,704 KB |
| 最終ジャッジ日時 | 2024-07-16 02:37:22 |
| 合計ジャッジ時間 | 5,724 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 WA * 2 |
ソースコード
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Scanner;
public class Main {
public static final long MOD = 1000000000000l;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
final long N = sc.nextLong();
BigInteger value = BigInteger.ONE;
for(long i = 2; i <= Math.min(N, 120); i++){
final BigInteger next_value = value.multiply(BigInteger.valueOf(i));
//System.out.println(next_value);
value = next_value;
}
final BigInteger mod = value.mod(BigInteger.valueOf(MOD));
System.out.println(mod.equals(BigInteger.ZERO) ? "000000000000" : mod.toString());
}
}
uafr_cs