例题1 uva11995 http://acm.hust.edu.cn/vjudge/problem/18700 猜测符合哪种数据结构 , 用stl模拟判断. 1 //#define txtout 2 //#define debug 3 #include<bits/stdc++.h> 4 #defi ...
分类:
其他好文 时间:
2016-08-08 22:44:13
阅读次数:
305
Question:
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the...
分类:
其他好文 时间:
2016-08-08 15:49:05
阅读次数:
132
#include<bits/stdc++.h>
usingnamespacestd;
charfun(chars[])
{
charret=‘\0‘;
if(s==NULL)returnret;
char*p=s;char*q=s;
while(*p!=‘\0‘)
{
while(*q!=‘\0‘)
{
++q;
if(*q==*p)break;
}
if(*q!=‘\0‘)
{
ret=*p;
break;
}
++p;
}
returnret;
}
charFind(char*str)
{
..
分类:
其他好文 时间:
2016-08-08 07:40:00
阅读次数:
135
最近在打cf时赛后翻阅别人的代码总是会发现一个陌生而奇怪的头文件#include<bits/stdc++.h> 奇怪之处就在于基本上所有的代码只要用了这个头文件就不再写其他头文件了。 百度过后仿佛打开了新世界的大门,头文件居然还可以这样用!!! #include<bits/stdc++.h>包含了目 ...
分类:
编程语言 时间:
2016-08-07 10:50:35
阅读次数:
322
Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur ...
分类:
其他好文 时间:
2016-08-06 17:19:28
阅读次数:
138
题意:统计区间内t=B^n+.....+B^0,每项系数都为0或1,统计1的个数恰好为1的情况,这样的数有多少个 分析:看的刘聪的论文,分析很好,http://pan.baidu.com/s/1pL4FF4n,转化为统计二叉树上1的个数代码写的有点糙 1 #include<bits/stdc++.h ...
分类:
其他好文 时间:
2016-08-06 16:00:02
阅读次数:
109
题意:区间内有多少任意两位差不小于2的 分析:任意两位差不小于2,那么要记录上一位选的是什么,还要注意上一位如果是前缀0的情况,再加一个标记,还要记录前面是否达到上限,然后就ok了 1 #include<bits/stdc++.h> 2 using namespace std; 3 const in ...
题意:求区间内不包含4和连续62的数的个数 分析:从高位向低位枚举,4的话,直接不枚举就行了,62用一个标志来记录上一个数是否是6,还要加一个表示上面是否达到上限,没有就可以枚举到9,否则枚举到liimt[len] 入门题,这个模型以后会经常用到 1 #include<bits/stdc++.h> ...
分类:
其他好文 时间:
2016-08-06 12:50:57
阅读次数:
103
A题:Opponents 直接模拟 #include <bits/stdc++.h> using namespace std; char ch[200]; int main() { int n,k; while(~scanf("%d%d",&n,&k)) { int p=0,sta=1,first= ...
分类:
其他好文 时间:
2016-08-04 21:31:21
阅读次数:
200