結果
問題 | No.526 フィボナッチ数列の第N項をMで割った余りを求める |
ユーザー |
![]() |
提出日時 | 2018-04-05 01:39:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 446 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 65,996 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 09:00:24 |
合計ジャッジ時間 | 1,661 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘void solve()’: main.cpp:21:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=] 21 | scanf("%d %d", &n, &m); | ~^ ~~ | | | | int* ll* {aka long long int*} | %lld main.cpp:21:20: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘ll*’ {aka ‘long long int*’} [-Wformat=] 21 | scanf("%d %d", &n, &m); | ~^ ~~ | | | | int* ll* {aka long long int*} | %lld main.cpp:27:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type’ {aka ‘long long int’} [-Wformat=] 27 | printf("%d\n", fin.back()); | ~^ ~~~~~~~~~~ | | | | int __gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type {aka long long int} | %lld main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%d %d", &n, &m); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <algorithm>#include <vector>#include <deque>#include <string>#include <iostream>using namespace std;using ll = long long;void solve();int main() {solve();#ifdef DBGwhile (true);#endif}//526void solve() {ll n, m;scanf("%d %d", &n, &m);deque<ll> fin({0, 1, 0});for (int i = 2; i <= n; i++) {fin.pop_front();fin.push_back((fin.front() + fin.back()) % m);}printf("%d\n", fin.back());}