51nod 2512
看错题目!!啊啊啊,都说了不能有前导,我怎么这么想当然呢!!另外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 ;
}
51nod 2512的更多相关文章
- 【51Nod 1244】莫比乌斯函数之和
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1244 模板题... 杜教筛和基于质因子分解的筛法都写了一下模板. 杜教筛 ...
- 51Nod 1268 和为K的组合
51Nod 1268 和为K的组合 1268 和为K的组合 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 给出N个正整数组成的数组A,求能否从中选出若干个,使 ...
- 51Nod 1428 活动安排问题
51Nod 1428 活动安排问题 Link: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1428 1428 活 ...
- 51Nod 1278 相离的圆
51Nod 1278 相离的圆 Link: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1278 1278 相离的圆 基 ...
- 【51Nod 1501】【算法马拉松 19D】石头剪刀布威力加强版
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1501 dp求出环状不连续的前缀和,剩下东西都可以算出来,比较繁琐. 时间 ...
- 【51Nod 1622】【算法马拉松 19C】集合对
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1622 简单题..直接暴力快速幂 #include<cstdio&g ...
- 【51Nod 1616】【算法马拉松 19B】最小集合
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1616 这道题主要是查询一个数是不是原有集合的一个子集的所有数的gcd. ...
- 【51Nod 1674】【算法马拉松 19A】区间的价值 V2
http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1674 对区间分治,统计\([l,r]\)中经过mid的区间的答案. 我的 ...
- 随便玩玩系列之一:SPOJ-RNG+51nod 算法马拉松17F+51nod 1034 骨牌覆盖v3
先说说前面的SPOJ-RNG吧,题意就是给n个数,x1,x2,...,xn 每次可以生成[-x1,x1]范围的浮点数,把n次这种操作生成的数之和加起来,为s,求s在[A,B]内的概率 连续形的概率 假 ...
随机推荐
- 如何使用纯 CSS 制作四子连珠游戏
序言:你是否想过单纯使用 CSS 也可以制作一款游戏?甚至可以双人对决!这是一篇非常有趣的文章,作者详细讲解了使用纯 CSS 制作四子连珠游戏的思路以及使用奇淫巧技解决困难问题的方法.因为案例本身比较 ...
- 关于使用nodejs的mysql查询时碰到的坑
今天在编写登录模块时,碰到一个隐蔽的坑,故记录一番 在使用Node.js的mysql模块的query方法时,查询语句使用了 `select password from login where name ...
- 收藏了8年的PHP优秀资源,都给你整理好了
https://segmentfault.com/a/1190000018071558 最后更新于 2019.02.12 以下是我整理好的 PHP 资源,各位看官拿去用,不用再自己找了. 每周在 Gi ...
- centos 7 修改网卡名字
1.编辑网卡信息 cd /etc/sysconfig/network-scripts/ #进入网卡目录mv ifcfg-en067761 ifcfg-eth0 #重命名网卡 cat ifcfg-eth ...
- Bitmap的使用习惯——及时释放Bitmap占用的内存
当Bitmap不再需要使用时,我们应该回收它占用的内存,如果我们直接把指向bitmap的引用置null的话,这样bitmap还是会存在内存中,直到GC机制起作用时,才可能会把这个bitmap回收.这样 ...
- VBS 备份文件
http://www.cnblogs.com/top5/archive/2009/11/17/1604767.html 参考上面的博客 ' =============== 局域网文件自动备份 VBS ...
- Tutorial: Create a Windows Machine Learning UWP application (C#)
In this tutorial, we'll build a simple Universal Windows Platform application that uses a trained ma ...
- codeforces581D
Three Logos CodeForces - 581D Three companies decided to order a billboard with pictures of their lo ...
- 快速排序-python
- python学习day15 模块(重点)
模块(重点) python2,与py3的区别 py2:range() 在内存中立即把所有的值都创建,xrange() 不会再内存中立即创建,而是在循环时边环边创建. py3:range() 不会再内存 ...