結果

問題 No.891 隣接3項間の漸化式
ユーザー sitihisitihi
提出日時 2019-09-22 02:50:36
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 281 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 28,876 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 06:54:22
合計ジャッジ時間 19,514 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 18 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 3 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 1 ms
4,348 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 1,694 ms
4,348 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 1,698 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#define M 1000000007
int main(){
  int x0, x1, x2, a, b, n, i, p, q, r;
  x0 = 0;
  x1 = 1;
  scanf("%d %d %d", &a, &b, &n);
  for (i=2; i<=n; i++){
    q = x1;
    x2 = a*x1+b*x0;
    x1 = x2;
    x0 = q;
    
  } 
  r = x2 % M;
  printf("%d", r);
  return 0;
}
0