結果
| 問題 |
No.194 フィボナッチ数列の理解(1)
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2015-04-26 22:58:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 537 bytes |
| コンパイル時間 | 1,192 ms |
| コンパイル使用メモリ | 159,880 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-07-05 03:15:45 |
| 合計ジャッジ時間 | 2,281 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 1 WA * 36 |
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
8 | main(){
| ^~~~
ソースコード
#include <bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
int A[20000];
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=(t*2-A[(i-n)%20000]+mod)%mod;
s=(s+a)%mod;
A[i%20000]=a;
}
std::cout << a << " " << s << std::endl;
}else{
// case 11-20
std::cout << "wakannai" << std::endl;
}
return 0;
}
tails