結果
問題 |
No.314 ケンケンパ
|
ユーザー |
|
提出日時 | 2020-06-24 21:38:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 1,000 ms |
コード長 | 286 bytes |
コンパイル時間 | 1,943 ms |
コンパイル使用メモリ | 192,428 KB |
最終ジャッジ日時 | 2025-01-11 09:54:35 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h> #define mod 1000000007 using namespace std; int main(){ cin.tie(0),ios::sync_with_stdio(false); int n; cin>>n; int64_t k1=1,k2=0,p=0; for(int i=1;i<n;++i){ int64_t tk1=k1,tk2=k2,tp=p; k1=tp%mod,k2=tk1%mod,p=tk1+tk2%mod; } cout<<(k1+k2+p)%mod<<"\n"s; }