09 2012 档案
摘要:bool findString(char* str, char* t){ if('\0' == *t) return 1; if('*' == *t){while('\0' != *str){if(findString(str++, t + 1))return 1;}}if('\0' == *str)return 0;if('?' == *t || *str == *t){return findString(str + 1, t + 1);}return 0;}
阅读全文
摘要:#include<iostream>#include<string>usingnamespacestd;stringadd(conststring&a,conststring&b){stringresult;//用于记录计算结果intlen_a=a.length()-1;intlen_b=b.length()-1;intcarry=0;//进位for(;len_a>=0&&len_b>=0;len_a--,len_b--){intt=(a[len_a]-'0')+(b[len_b]-'0')+c
阅读全文
摘要:#include <cstdlib>#include <iostream>using namespace std;int Partition(int list[], int low, int high){ int pivotkey = list[low]; while(low < high) { while(low<high && list[high]>= pivotkey) high--; //找到第一个小于key的记录 if(low < high) list[low++] = list[high];//相当于交换了list[i
阅读全文
摘要:#include <stdio.h>#include <stdlib.h>static char Queen[8][8];static int a[8];static int b[15];static int c[15];static int iQueenNum = 0;//record statevoid qu(int i);int main(int argc, char *argv[]){ //init int line, column; for(line = 0;line < 8;line++) { a[line] = 0; for(colu...
阅读全文
摘要:使用异或a = a^b;b = a^b;a = a^b;异或运算法则 1. a ^ b = b ^ a 2. a ^ b ^ c = a ^ (b ^ c) = (a ^ b) ^ c; 3. d = a ^ b ^ c 可以推出 a = d ^ b ^ c. 4. a ^ b ^ a = b.
阅读全文
摘要:int max = ((a+b) + abs(a-b)) / 2;
阅读全文

浙公网安备 33010602011771号