結果
| 問題 | No.500 階乗電卓 |
| コンテスト | |
| ユーザー |
akitsu818
|
| 提出日時 | 2017-04-30 23:10:06 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 513 bytes |
| 記録 | |
| コンパイル時間 | 2,408 ms |
| コンパイル使用メモリ | 82,480 KB |
| 実行使用メモリ | 1,243,488 KB |
| 最終ジャッジ日時 | 2026-04-04 08:53:08 |
| 合計ジャッジ時間 | 16,525 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 MLE * 9 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String args[]){
Scanner cin = new Scanner(System.in);
long N = cin.nextLong();
cin.close();
long tmp = 0L;
int sub=0;
tmp = func(N);
if(N>=16&&tmp<(long)Math.pow(10, 11)){
sub = 12-String.valueOf(tmp).length();
for(int i =0;i<sub;i++){
System.out.print("0");
}
}
System.out.println(tmp);
}
static long func(long n){
if(n==0L){
return 1;
}else{
return (n*func(n-1))%(long)Math.pow(10, 12);
}
}
}
akitsu818