DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to ...
分类:
其他好文 时间:
2014-07-18 15:28:57
阅读次数:
234
题目:给出一个正整数n,打印出所有从1~n的素数(即质数);关键是要找出一个判断一个正整数n是否为素数的方法...傻瓜解法--n,n/2 1 #include 2 int main() 3 { 4 int i,n; 5 while(scanf("%d",&n)==1) 6 { for(i...
分类:
其他好文 时间:
2014-07-18 15:19:43
阅读次数:
192
#includeintnum[]={3,5,7,9,10,10,10,12,15,20,25,30};//10个数intlower_bound(int*A,intL,intR,intV){intm;while(L=V)R=m;//所求点在中点以左elseL=m+1;//所求点在中点以右}return...
分类:
其他好文 时间:
2014-07-18 14:29:37
阅读次数:
268
#include using namespace std;int num[]={3,5,7,9,10,12,15,20,25,30};//10个数int main(){ int x; while(cin>>x) { int L,R,mid; L=0;R=...
分类:
其他好文 时间:
2014-07-18 14:24:25
阅读次数:
314
#include using namespace std;const int MOD = 1000;//像这样的一个常量就应该专门定义一下int PowMod(int a, int n)//a^n%MOD { int ret = 1; while(n) { ...
分类:
其他好文 时间:
2014-07-18 12:15:38
阅读次数:
190
fopen打开配置文件,不需要绝对路径,可以使相对路径fgets按行读取文件while(fgets(buf, 1024, fptr)){}strtok_r或者strtok解析参数 int main(int argc, char *argv[]) { ...
分类:
其他好文 时间:
2014-07-18 12:14:09
阅读次数:
187
A few things to remember while coding in Python. - 17 May 2012 - UPDATE: There has been much discussion in Hacker News about this article. A few corre...
分类:
编程语言 时间:
2014-07-18 00:23:05
阅读次数:
481
1.pthread_create function creates thread that share the same memory with the process.2.pthread_join function wait for threads until they stop3.The pth...
分类:
系统相关 时间:
2014-07-18 00:19:54
阅读次数:
317
1、二分查找代码二分查找的代码. int bfind(int* a,int len,int val) { int m = len/2; int l = 0; int r = len; while(l!=m && r!= m) { if(...
分类:
其他好文 时间:
2014-07-18 00:01:25
阅读次数:
213
#include "stdafx.h"#include #include using namespace std;DWORD WINAPI ThreadFuncFirst(LPVOID param){int iCount = 50;while(iCount--){cout<<"\nThreadFun...
分类:
编程语言 时间:
2014-07-17 21:29:18
阅读次数:
209