結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー |
![]() |
提出日時 | 2025-03-27 14:24:27 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 324 bytes |
コンパイル時間 | 297 ms |
コンパイル使用メモリ | 24,832 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-27 14:24:29 |
合計ジャッジ時間 | 1,733 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:4:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | scanf("%d %d",&n,&m); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>void main(void){int n = 0 , m = 0;scanf("%d %d",&n,&m);long long int lastTime = 0 , total = 1 ,result = (lastTime + total) % m;for(int i = 3 ; i < n ; i++){lastTime = total;total = result;result = (lastTime + total) % m;}printf("%lld",result);}