Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example: Given num = 16, return true. Given num = 5, return f ...
分类:
其他好文 时间:
2016-08-21 13:58:06
阅读次数:
115
题目链接:hdu_5832_A water problem 这是一个惨痛的教训,想这种这么大的大数肯定就是找个规律模拟一下。 然而我们队还写JAVA,用大数艹了13发罚时,真是TM智障了。 1 #include<bits/stdc++.h> 2 using namespace std; 3 4 co ...
分类:
其他好文 时间:
2016-08-15 20:47:17
阅读次数:
181
1011:水题。 #include<bits/stdc++.h> #define REP(i,a,b) for(int i=a;i<=b;i++) #define MS0(a) memset(a,0,sizeof(a)) using namespace std; typedef long long ...
分类:
其他好文 时间:
2016-08-15 06:41:26
阅读次数:
386
下列输出的值: answer = 2 - 3 * 4; 所以结果 -10; 5.3 编写函数 unsigned int reverse_bits(unsigned int value);将二进制模式从左到右变换,输入25输出2 550 136 832 ...
分类:
其他好文 时间:
2016-08-14 16:09:43
阅读次数:
88
Given an integer (signed 32 bits), write a function to check whether it is a power of 4.
Example:
Given num = 16, return true. Given num = 5, return false.
Follow up: Could you solve it withou...
分类:
其他好文 时间:
2016-08-13 12:57:27
阅读次数:
143
#include<bits/stdc++.h>
usingnamespacestd;
intjudge_palindrome(strings)
{
stringtmp=s;
std::reverse(tmp.begin(),tmp.end());//tmp和t是s的翻转
stringt(tmp);//构造新串t
//return!!t.compare(s);//和原串进行比较
returnt==s;
}
intmain()
{
strings="goog";
i..
分类:
其他好文 时间:
2016-08-12 22:01:09
阅读次数:
125
//百万数内看数列离散点根据x找接近的数列数
#include<bits/stdc++.h>
usingnamespacestd;
intfunsteap(intxx)
{
intret=0;
//循环去构造数列是容易的
intx=0;
inty=1;
inttmp=1;
/*
011235(7)8
*/
while(tmp<xx)
{
tmp=x+y;
x=y;
y=tmp;
}
//cout<<tmp<<..
分类:
移动开发 时间:
2016-08-12 21:54:19
阅读次数:
147
题目链接:Codeforces Round #367 (Div. 2) D. Vasiliy's Multiset 题意: 给你一些操作,往一个集合插入和删除一些数,然后?x让你找出与x异或后的最大值 题解: trie树xjb搞就行,每次要贪心,尽量满足高位为1. 1 #include<bits/s ...
分类:
其他好文 时间:
2016-08-12 19:46:50
阅读次数:
146
/*
关于这数组偏移
123453---->>34512
n=5返回2
*/
#include<bits/stdc++.h>
usingnamespacestd;
inta[]={1,2,3,4,5};
intn=5;
intcount=3;
intfun(intn,inta[],intcount,intlen)//不给数组长度真的不好做,JAVA是能由数组直接拿
{
intb[2*len];intret=0;
for(int..
分类:
编程语言 时间:
2016-08-12 06:48:19
阅读次数:
170
题目: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight). For example, the 32- ...
分类:
其他好文 时间:
2016-08-10 11:04:27
阅读次数:
172