codeforces630C

Lucky Numbers

 CodeForces - 630C 

小希称只含7和8的数是幸运数,那么不超过n位的幸运数有多少个?

Input

一个整数 n (1 ≤ n ≤ 55) 

Output

输出幸运数的数量

Example

Input

2

Output

6

sol:这和0,1有个屁区别 ----摘自yj大佬原话

结论非常显然小学生都知道 2n+1-2

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read()
{
    ll s=0;
    bool f=0;
    char ch=' ';
    while(!isdigit(ch))
    {
        f|=(ch=='-'); ch=getchar();
    }
    while(isdigit(ch))
    {
        s=(s<<3)+(s<<1)+(ch^48); ch=getchar();
    }
    return (f)?(-s):(s);
}
#define R(x) x=read()
inline void write(ll x)
{
    if(x<0)
    {
        putchar('-'); x=-x;
    }
    if(x<10)
    {
        putchar(x+'0');    return;
    }
    write(x/10);
    putchar((x%10)+'0');
    return;
}
#define W(x) write(x),putchar(' ')
#define Wl(x) write(x),putchar('
')
ll n;
int main()
{
    ll ans=0;
    R(n);
    Wl(1ll*((1ll<<(n+1))-2));
    return 0;
}
View Code
原文地址:https://www.cnblogs.com/gaojunonly1/p/10651230.html