C. Ivan the Fool and the Probability Theory

mac2025-05-23  54

http://codeforces.com/contest/1248/problem/C

 

#include <bits/stdc++.h> //#include <cmath> //#include <iostream> //#include <unordered_map> #define mem(x,y) memset(x,y,sizeof(x)) #define pb push_back #define INF 0x3f3f3f3f #define ll long long #define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; const int mod=1e9+7; const int N=2e5+9; ll dp[N]; int main() { FAST_IO; ll n,m; cin>>n>>m; dp[1]=2; dp[2]=4; for(int i=3;i<=max(n,m);i++) { dp[i]=(dp[i-1]+dp[i-2])%mod; } cout<<(((dp[n]+dp[m])%mod+mod-2)%mod)<<endl; return 0; }

 

最新回复(0)