51nod 2512

时间:2021-07-30 06:14:37

看错题目!!啊啊啊,都说了不能有前导,我怎么这么想当然呢!!另外1也是2的幂次方

代码:

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
using namespace std;
#define maxn 1000000008
#define ll long long int num[];
char s[];
int main(){
scanf("%s",s);
int len=strlen(s);
rep(i,,len){
int x=s[i]-'';
// cout<<x<<endl;
num[x]++;
}
ll b=;
int flag=;
while(b<maxn){
ll tp=b;
int tmp[];
memset(tmp,,sizeof(tmp));
while(tp){
int x=tp%;
tmp[x]++;
tp/=;
// cout<<" <"<<x<<"> "<<endl;
}
int f=;
rep(i,,){
if(num[i]!=tmp[i]){
f=;
break;
}
}
if(f)
{
flag=;
break;
}
b<<=;
}
if(flag)
cout<<"true"<<endl;
else
cout<<"false"<<endl;
return ;
}