目录
BZOJ1192 鬼谷子的钱袋
题解
比较水的题目,只要知道用1、2、4...\(2^n\)可以组成\([1,2^{n+1})\)这个区间里的任意一个数这个结论就行了。
code
#includeusing namespace std;typedef long long ll;bool Finish_read;template inline void read(T &x){Finish_read=0;x=0;int f=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')f=-1;if(ch==EOF)return;ch=getchar();}while(isdigit(ch))x=x*10+ch-'0',ch=getchar();x*=f;Finish_read=1;}template inline void print(T x){if(x/10!=0)print(x/10);putchar(x%10+'0');}template inline void writeln(T x){if(x<0)putchar('-');x=abs(x);print(x);putchar('\n');}template inline void write(T x){if(x<0)putchar('-');x=abs(x);print(x);}/*================Header Template==============*/ll m,now;int n;/*==================Define Area================*/int main() { read(m); now=1;n=1; if(m==2) return puts("2"),0; while((now<<=1)