hello world
来源:互联网 发布:用户角色模型 java 编辑:程序博客网 时间:2024/06/02 21:07
hello world.
demo code.
// 60_FineNumberAppearOnceTheOthersAppear3Times.cpp : Defines the entry point for the console application.///*version: 1.0author: hellogiserblog: http://www.cnblogs.com/hellogiserdate: 2014/5/28*/#include "stdafx.h"/*1,1,1,2,2,2,3001,001,001,010,010,010011number of 1: 003+030+011 = 044 044 % 3 = 011 ===>3*/int FindNumberAppearOnce_WithTheOther3Times(int data[],int length){if(NULL==data||length<=0)return -1;const int N = 32;// count the 1s of 32 bitint counts[N] = {0};for (int i=0;i<length;++i){for (int j=0;j<N;++j){counts[j] = (counts[j] + (data[i]>>j&1))%3;}}// get the resultint result=0;for (int j=0;j<N;++j)result +=(counts[j]<<j);return result;}void test_base(int data[],int length){int result = FindNumberAppearOnce_WithTheOther3Times(data,length);printf("%d \n",result);}void test_case1(){int data[] = {1,1,1,2,2,2,3};int length = sizeof(data)/sizeof(int);test_base(data,length);}void test_case2(){int data[] = {1,1,1,2,2,2,3,3,3,4};int length = sizeof(data)/sizeof(int);test_base(data,length);}void test_main(){test_case1();test_case2();}int _tmain(int argc, _TCHAR* argv[]){test_main();return 0;}/*34*/
0 0
- Hello World!【Hello World】
- Hello, world!
- Hello World!
- Hello world!
- Hello World!
- Hello World!
- hello world!
- Hello World !
- Hello,World!
- Hello World!
- Hello world!
- Hello World!
- Hello World
- Hello World
- Hello world
- Hello World!
- Hello world
- Hello World !
- 用GDB调试程序
- 男人就是累
- Dotnetnuke:EditURL与NavigateURL
- Linux Server流媒体配置过程
- 14.1动物这样叫(一)
- hello world
- 配置我的vim
- Cucumber 插件的折腾
- 自守数
- dda算法
- fullbnt使用中bnet中CPD查看方法与输入证据后节点查询方法
- Android中webview和js之间的交互
- linux 编译安装mysql5.5
- UIView动画