結果
| 問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-27 14:19:50 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 288 bytes |
| コンパイル時間 | 248 ms |
| コンパイル使用メモリ | 24,960 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-27 14:19:52 |
| 合計ジャッジ時間 | 971 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 8 |
コンパイルメッセージ
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 total = 1 ,lastTime = 0;
for(int i = 2 ; i < n ; i++){
long long int copy = total;
total += lastTime;
lastTime = copy;
}
printf("%lld",total%m);
}
Maeda