結果
| 問題 | No.500 階乗電卓 |
| コンテスト | |
| ユーザー |
Bantako
|
| 提出日時 | 2017-07-07 20:46:57 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 451 bytes |
| 記録 | |
| コンパイル時間 | 404 ms |
| コンパイル使用メモリ | 40,260 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-11 07:34:50 |
| 合計ジャッジ時間 | 958 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | main(){
| ^~~~
ソースコード
#include<stdio.h>
main(){
long long N;
scanf("%lld",&N);
long long max = 1000000000000;
long long ans = 1;
if(N < 50){
for(int i = 1;i <= N;i++){
ans *= i;
ans %= max;
}
if(N < 15){//10^12超えない
printf("%lld\n",ans);
}else{//超える
printf("%012lld\n",ans);
}
}else{//下12桁0埋め
printf("000000000000\n");
}
}
Bantako