Experimental Educational Round: VolBIT Formulas Blitz C
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Experimental Educational Round: VolBIT Formulas Blitz C相关的知识,希望对你有一定的参考价值。
Description
The numbers of all offices in the new building of the Tax Office of IT City will have lucky numbers.
Lucky number is a number that consists of digits 7 and 8 only. Find the maximum number of offices in the new building of the Tax Office given that a door-plate can hold a number not longer than n digits.
The only line of input contains one integer n (1 ≤ n ≤ 55) — the maximum length of a number that a door-plate can hold.
Output one integer — the maximum number of offices, than can have unique lucky numbers not longer than n digits.
2
6
1位数的,7 8
2位数的,77 78 87 88
3位数的,777 778 787 788 877 878 887 888
.....
#include<stdio.h> //#include<bits/stdc++.h> #include<string.h> #include<iostream> #include<math.h> #include<sstream> #include<set> #include<queue> #include<map> #include<vector> #include<algorithm> #include<limits.h> #define inf 0x7fffffff #define INF 0x7fffffffffffffff #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define LL long long #define ULL unsigned long long using namespace std; LL powl(LL x, LL n) { LL pw = 1; while (n > 0) { if (n & 1) // n & 1 等价于 (n % 2) == 1 pw *= x; x *= x; n >>= 1; // n >>= 1 等价于 n /= 2 } return pw; } int main() { LL n; LL num; cin>>n; cout<<powl(2,n+1)-2<<endl; // printf("%.20f\n",n*powl(1.000000011,num)); return 0; }
以上是关于Experimental Educational Round: VolBIT Formulas Blitz C的主要内容,如果未能解决你的问题,请参考以下文章
Experimental Educational Round: VolBIT Formulas Blitz D
Experimental Educational Round: VolBIT Formulas Blitz C
Experimental Educational Round: VolBIT Formulas Blitz F
C++ VS 错误:提供 std::experimental::filesystem 的 <experimental/filesystem> 标头已被 Microsoft 弃用,并将被删除