結果

問題 No.500 階乗電卓
ユーザー akitsu818
提出日時 2017-04-08 00:20:30
言語 Java
(openjdk 23)
結果
MLE  
実行時間 -
コード長 452 bytes
コンパイル時間 2,513 ms
コンパイル使用メモリ 75,084 KB
実行使用メモリ 832,372 KB
最終ジャッジ日時 2024-07-16 03:32:53
合計ジャッジ時間 6,099 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other MLE * 1 -- * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main{
    public static void main(String args[]){
    Scanner cin = new Scanner(System.in);

    long target = cin.nextLong();
    long res = func(target);
    
    int size = String.valueOf(res).length();

    if(size>12){
    res = (long)(res%Math.pow(10,13));
    }
    System.out.println(res);
    }

    static long func(long num){
        if(num==0){
            return 1;
        }
    return num*func(num-1);
    }
}
0