Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 2021
- #include<bits/stdc++.h>
- using namespace std;
- //constant define things
- #define pb(a) push_back(a);
- #define pf(a) push_front(a);
- #define ff first
- #define ss second
- #define all(s) s.begin(),s.end()
- #define pii pair<int,int>
- #define pll pair<long,long>
- bool isVowel(char a){
- a=tolower(a);
- return (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'?true:false);
- }
- double find_dist(int x1,int y1,int x2,int y2){
- return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
- }
- int to_int(string s){
- // stoi() ->function to int up to 9.2.0 versions
- int n=0,i=0;
- if(s[0]=='-')i=1;
- for(;i<(int)s.size();i++) n=n*10+(int(s[i])-48);
- if(s[0]=='-')n*=-1;
- return n;
- }
- string to_str(int X){
- // bug is that -9123 is not works because of sign '-'
- //to_string() -> function for c++ 17
- string ANS="";
- while(X>0){
- ANS+=(X%10)+'0';
- X/=10;
- }
- reverse(ANS.begin(),ANS.end());
- return ANS;
- }
- int BinaryToDecimal(int x){
- int cnt=0,ans=0;
- while(x>0){
- if(x%10==1){
- ans+=pow(2,cnt);
- }
- x/=10;
- cnt++;
- }
- return ans;
- }
- string decimalTObinary(int n) {
- string s="";
- if(n==0)return 0;
- else{
- for(int i=0;n>0;i++){
- s+=((n%2)+'0');
- n/=2;
- }
- return s;
- }
- }
- bool isPrime(int x){
- for(int i=2;i<=sqrt(x);i++){
- if(x%i==0){
- return false;
- }
- }
- return true;
- }
- int gcd(int a,int b){
- if(a==0) return b;
- return gcd(b%a,a);
- }
- int lcm(int a,int b){
- return a*(b/gcd(a,b));
- }
- vector<int>All_Factors(int n){
- vector<int>factors;
- for(int i=1;i<=sqrt(n);i++){
- if(n%i==0){
- factors.push_back(i);
- if(i!=n/i){
- factors.push_back(n/i);
- }
- }
- }
- return factors;
- }
- // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- #define int long long
- const int N=2e4,INF=1e9+7;
- vector<int>dp(101,0);
- int FFF(int x){
- if(x==1)return 2;
- if(x==2)return 3;
- if(x==3)return 5;
- if(dp[x])return dp[x];
- return dp[x]=FFF(x-1)+FFF(x-2);
- }
- void bbb(){
- int n;
- cin>>n;
- cout<<FFF(n);
- }
- signed main(){
- ios_base::sync_with_stdio(false); cin.tie(nullptr);cin.tie(nullptr);
- int test_cases=1;
- //cin>>test_cases;
- while(test_cases-->0){
- bbb();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement