結果
問題 | No.314 ケンケンパ |
ユーザー |
![]() |
提出日時 | 2017-01-31 17:56:04 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 1,000 ms |
コード長 | 517 bytes |
コンパイル時間 | 563 ms |
コンパイル使用メモリ | 21,632 KB |
実行使用メモリ | 13,184 KB |
最終ジャッジ日時 | 2024-12-23 22:57:42 |
合計ジャッジ時間 | 1,477 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<stdlib.h>void run(void){int n;scanf("%d",&n);const int mod=1000000007;int *ken=(int *)calloc(n+1,sizeof(int));int *kenken=(int *)calloc(n+1,sizeof(int));int *pa=(int *)calloc(n+1,sizeof(int));ken[1]=1;int i;for(i=2;i<=n;i++){ken[i]=pa[i-1];kenken[i]=ken[i-1];pa[i]=(ken[i-1]+kenken[i-1])%mod;}printf("%d\n",((ken[n]+kenken[n])%mod+pa[n])%mod);free(ken);free(kenken);free(pa);return;}int main(void){run();return 0;}