#include <bits/stdc++.h> using namespace std; typedef long long LL; inline LL read () { LL res = 0 ;int f (1) ;char ch = getchar (); while (!isdigit(ch)) { if (ch == '-') f = -1 ;ch = getchar();} while (isdigit(ch)) res = (res << 1) + (res << 3) + (ch ^ 48) ,ch = getchar(); return res * f ; } LL n; LL a[1<<20]; signed main () { n=read(); a[1]=1; a[2]=2; for(register int i=3;i<=n;i++) a[i]=((a[i - 1] << 1)+(a[i - 2])) %1000000007 ; cout << a[n] << endl ; return 0; }
P4451 [国家集训队]整数的lqp拆分
不存在十全十美的文章 如同不存在彻头彻尾的绝望