結果

問題 No.500 階乗電卓
ユーザー naipia
提出日時 2018-07-10 12:18:08
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 322 bytes
コンパイル時間 1,281 ms
コンパイル使用メモリ 156,664 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 04:44:50
合計ジャッジ時間 2,190 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll MOD = 1e12;

int main(){
    ll n,ans=1;
    cin >> n;
    for(int i=0;i<n;i++){
        (ans*=(i+1))%=MOD;
        if(ans==0){
            printf("%012lld\n",ans);
            return 0;
        }
    }
    printf("%lld\n",ans);
    return 0;
}
0