//way 1union{ unsigned long biths; unsigned char bytes[4];} theValue;//way 2ndtypedef char* bytePointer;void showBytes(bytePointer p, int len){ in...
分类:
其他好文 时间:
2015-03-30 23:04:15
阅读次数:
195
组员 石鹤李海超一、题目输出一个数组中最大和的子数组,数组为int32型,有1000个数,保证最大子数组的和不溢出。二、设计思想随机产生一千个数的数组,求最大子数组和的过程中判断是否溢出,如果溢出,则输出溢出。三、源代码#includelong MAX(unsigned long arry[],in...
分类:
编程语言 时间:
2015-03-30 20:52:56
阅读次数:
154
题目描述:
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-bit integer ’11' has binary representa...
分类:
其他好文 时间:
2015-03-30 18:42:17
阅读次数:
128
1.范围的作用,看看一下结构体:
[plain] view plaincopy
typedef struct _NSRange {
unsigned int location;
unsigned int length;
}N...
分类:
移动开发 时间:
2015-03-30 16:30:36
阅读次数:
130
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in...
分类:
其他好文 时间:
2015-03-30 13:09:17
阅读次数:
161
题目:1亿个QQ号存在set和vector两个容器当中,请你剔除个位数为奇数的QQ号码。问题分解:问题一:QQ号用什么类型存储?问题二:vector 最好不删除中间元素?问题三:set是由红黑树实现的,插入,删除操作对效率的影响大吗?问题一分析:unsigned int 在32位机中最大存储数为2^...
分类:
其他好文 时间:
2015-03-30 12:37:14
阅读次数:
111
枚举断点,哈希判断。#includeusing namespace std;typedef unsigned long long ull;ull hs,hs1,hs2,seeds[1000010],hsgoal;int n;int del=-1;char s[2000002],s2[2000002]...
分类:
其他好文 时间:
2015-03-30 11:01:28
阅读次数:
228
这个题目比较简单,但是有些细节。
比如:50个输入,每个都是10^9,但是奖品最高价格为5.
那么奖品5的数量将会超过int的表示范围,所以cnt要用unsigned long long类型。#include
#include
typedef unsigned long long LL;
int n;
int points[60];
int cost[5...
分类:
其他好文 时间:
2015-03-30 01:38:01
阅读次数:
188
如果有题目要求整数A和B二进制表示中多少位是不同的? 那我们要先考虑一个unsigned类型中变量1的个数?我们可以考虑简单的移位运算,向右移位,我们进行判断如果不是1直接丢掉,使用&运算符即可。int count(unsigned A){ int num = 0; while(A...
分类:
其他好文 时间:
2015-03-29 23:40:48
阅读次数:
127
之前写到几个排序的算法,例如://冒泡排序void bubbleSort(unsigned char *list, int length){ int i,j,temp; for(i = 0; i < length; i++) { for(j = 0; j < leng...
分类:
编程语言 时间:
2015-03-29 16:17:17
阅读次数:
112