結果
問題 | No.500 階乗電卓 |
ユーザー |
![]() |
提出日時 | 2017-04-08 23:27:59 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 372 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 22,784 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 02:57:56 |
合計ジャッジ時間 | 969 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%llu",&n); | ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <math.h>#include <stdlib.h>int main(void){unsigned long long n;scanf("%llu",&n);if(n>=50){printf("000000000000\n");return 0;}int i;unsigned long long dp[50];dp[0]=1;dp[1]=1;for(i=2;i<n+1;i++){dp[i]=(dp[i-1]*i)%1000000000000;}if(n<16){printf("%llu\n",dp[n]);}else{printf("%012llu\n",dp[n]);}return 0;}