結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2019-04-15 22:47:01 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 363 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 29,184 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 08:07:28 |
合計ジャッジ時間 | 864 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
// yukicoder: No.500 階乗電卓// 2019.4.15 bal4u#include <stdio.h>#define MOD 1000000000000int main(){int i;long long N, ans;scanf("%lld", &N);if (N >= 50) { puts("000000000000"); return 0; }ans = 1; for (i = (int)N; i >= 2; i--) {ans = (ans * i) % MOD;}if (N >= 15) printf("%012lld\n", ans);else printf("%lld\n", ans);return 0;}