质因数分解
/* 求质因数 */
#include
#include
int main()
{
int n,a=2;
printf("please input n:");
scanf("%d",&n);
if(n<=1)
{
printf("input error!\n");
return -1;
}
while(a*a < n)
{
while(n%a==0)
...
分类:
其他好文 时间:
2014-05-26 05:50:40
阅读次数:
279
引言shell,我们经常会用到,以其强大的功能,会帮助我们解决很多棘手的问题。最近遇到一个问题,要跑很多case,如果串行的执行,需要很久。能不能让他们并行起来,但又不能所有case都并行运行呢?,因为所有case同时运行,机器会挂掉的。1,方式1比较直接的一种方式是,维护两个文件队列(*.start和*.stop)分别记录所有case的运行状态,然后根据并发数量来获取和分配资源。代码如下:mul...
分类:
其他好文 时间:
2014-05-26 05:07:22
阅读次数:
262
第一种方法:
#include
void dectobin(int n);
int main()
{
int x=0;
scanf("%d",&x);//只能正数
dectobin(x);
printf("\n");
return 0;
}
void dectobin(int n)
{
if(n/2>0)
{
dectobin(n...
分类:
编程语言 时间:
2014-05-26 04:43:00
阅读次数:
322
假定每个单词用空格隔开。
例子:
输入:how are you!
输出:3
两种方法:
一:
#include
#include
#define SIZE 20
int main()
{
char str[SIZE]={'\0'};
int count=0;
printf("please input the string\n");
gets(str);
put...
分类:
编程语言 时间:
2014-05-26 03:44:36
阅读次数:
284
一、编译环境的准备 yum install gcc yum install gcc-c++ libstdc++-devel yum install zlib-devel二、源码包准备wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gzwget http://memcached.googlecode.com/files/me...
分类:
系统相关 时间:
2014-05-26 03:38:01
阅读次数:
375
#include
int main()
{
int a;
while(1)
{
printf("please input the number:\n");
scanf("%d",&a);
if(a&1)
{
printf("%d是奇数\n",a);
}
else
{
printf("%d是偶数\n",a);
}
}
return 0;
}这...
分类:
编程语言 时间:
2014-05-26 03:36:15
阅读次数:
367
int cnt = 0;
while(1) {
++cnt;
ptr = (char *)malloc(1024*1024*128);
if(ptr == NULL) {
printf("%s\n", "is null");
break;
}
}
printf("%d\n", cnt);
这个程序会有怎样的输出呢?...
分类:
系统相关 时间:
2014-05-24 21:59:47
阅读次数:
479
printf的占位符(%) 异常
本文地址: http://blog.csdn.net/caroline_wendy/article/details/26719135
C语言中, 使用%代表占位符的意思, 如%d代表int类型, %f代表float类型.
需要注意的是, 占位符需要和使用参数匹配, 否则会出现越界或截断的情况;
如%f, 匹配5, 会导致使用8个字节去匹配4个字节, 会产生越界, 输出0;
%d, 匹配5.01...
分类:
编程语言 时间:
2014-05-24 17:58:04
阅读次数:
279