昨天在leetcode做题的时候做到了371,原题是这样的: 371. Sum of Two Integers Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -. Example: Given a = 1 and b = 2, return 3. 因为之前完全没有在实际练习中使用过位运算,所以刚看到这道题目的时候我的第一反应是 1.用乘除代替加减,但是一想,…
最近做在Windows XP X64,VS2005环境下做32位程序编译为64位程序的工作,遇到了一些64位编程中可能遇到的问题:如内联汇编(解决方法改为C/C++代码),long类型的变化,最关键的遇到了64位进程需要调用32位dll的问题.由于有一些32位dll没有源代码,无法重新编译为64位dll,所以只能想办法解决64位进程调用32位dll问题,这个问题让我很是挠头了几天. 相关资料:微软公司的官方网站针对这个问题描述如下:在64位的windows系统中,一个64位进程不能加载一个32位…
//在JS中,将text框中数据格式化,根据不同的小数位数,格式化成对应的XXX,XXX,XXX.XX(2位小数) 或者XXX,XXX,XXX(0位小数) function formatNum(num, n) {//参数说明:num 要格式化的数字 n 保留小数位 num = String(num.toFixed(n)); })/; while (re.test(num)) num = num.replace(re, "$1,$2") return num; }…
//求两个数中不同的位的个数 #include <stdio.h> int count_different(int a, int b) { int count = 0; int c = a^b; //a,b中不同的位即为1 while (c) { count++; c = c&(c - 1); //把c中最后一个1去掉 } return count; } int main() { printf("%d\n", count_different(3,8)); //3 p…
错误描述 在Win7下安装了Oracle 11g R2,在用Navicat去连接Oracle时,提示以下错误: Cannot load OCI DLL, 126: Instant Client package is required for Baic and TNS connection For more information: http://wiki.navicat.com/wiki/index.php/Instant_client_required 错误原因 本地安装的是64位的Oracl…
Problem Description There must be many A + B problems in our HDOJ , now a new one is coming. Give you two hexadecimal integers , your task is to calculate the sum of them,and print it in hexadecimal too. Easy ? AC it ! Input The input contains seve…
Number类型: Number类型是ECMAScript中最常用和最令人关注的类型了:这种类型使用IEEE754格式来表示整数和浮点数值(浮点数值在某些语言中也被成为双精度数值),为支持各种数据类型,ECMA-262定义了不同的数值面量格式. 十进制: var intNum=10; //整数 八进制: var octalNum1=070; //八进制的56 var octalNum2=079; //无效的八进制数值-解析为79 八进制字面量在严格模式下是无效的: 十六进制: var hexNu…
B. Tavas and SaDDas time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing…
//---------------+-*/%算法---------------------------------------------------------- #include <iostream> using namespace std; // 函数原型声明 int Add(int e1, int e2); int Sub(const int*pe1, const int*pe2); int Mul(const int&re1, const int&re2); int…