結果
| 問題 | No.500 階乗電卓 |
| コンテスト | |
| ユーザー |
ひゅーら
|
| 提出日時 | 2017-06-25 14:50:01 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 311 bytes |
| 記録 | |
| コンパイル時間 | 224 ms |
| コンパイル使用メモリ | 28,800 KB |
| 実行使用メモリ | 12,032 KB |
| 最終ジャッジ日時 | 2024-10-04 08:40:43 |
| 合計ジャッジ時間 | 6,769 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | TLE * 1 -- * 19 |
ソースコード
#include <stdio.h>
int main(void){
long n;
scanf("%ld", &n);
long ans = 1;
int flag;
for(long i = 1; i <= n; i++){
ans *= (i%1000000000000);
if(ans > 1000000000000){
flag = 1;
}
ans %= 1000000000000;
}
if(flag == 0){
printf("%ld\n", ans);
}
else{
printf("%012ld\n", ans);
}
return 0;
}
ひゅーら