結果
問題 | No.194 フィボナッチ数列の理解(1) |
ユーザー |
![]() |
提出日時 | 2015-04-26 23:39:33 |
言語 | C++11 (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 525 bytes |
コンパイル時間 | 1,174 ms |
コンパイル使用メモリ | 158,768 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-05 02:49:35 |
合計ジャッジ時間 | 2,273 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 RE * 1 |
other | AC * 10 RE * 27 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 7 | main(){ | ^~~~
ソースコード
#include <bits/stdc++.h> #define mod 1000000007 int A[10000]; main(){ int n,k; std::cin >> n >> k; if(k<=1000000){ // case 1-10 int s=0; int a; for(int i=0;i<n;++i){ std::cin >> a; s=(s+a)%mod; A[i]=a; } int t=s; for(int i=n;i<k;++i){ a=t; t=unsigned(t*2-A[i%n]+mod)%mod; s=(s+a)%mod; A[i%n]=a; } std::cout << a << " " << s << std::endl; }else{ // case 11-20 std::cout << "wakannai" << std::endl; exit(2); } return 0; }