#include<stdio.h>#include<string.h>charfound(charstr[]){inti=0; intj=0; intcount; intlen=strlen(str); for(i=0;i<len;i++) { count=0;//每次执行外层循环时count都要置0 for(j=len-1;j>=0;j--) { if(str[i]==str[j]) { count++; } if(co..
分类:
其他好文 时间:
2015-07-30 23:35:38
阅读次数:
121
编程语言中实现自动垃圾回收机制方式有好几种,常见的有标记清除,引用计数,分代回收等。
C++需要手动管理垃圾,可以自己实现一个智能指针。最简单的是引用计数的思路
template
class SmartPointer {
T* obj;
unsigned int* count;
SmartPointer(T* ptr) {
obj = ptr;
...
分类:
其他好文 时间:
2015-07-30 23:31:19
阅读次数:
194
1.vmstat 常用指令
vmstat 统计虚拟内存信息,可以对操作系统的proc、memory、CPU、IO等信息进行统计以呈现给用户。一般vmstat工具的使用是通过两个数字参数来完成的,[ delay [ count ] ]其中delay是间隔,count显示多少次信息。如:vmstat 1 3 是每1秒显示一次,共显示3次。
2.vmstat其他指令详解
vmstat...
分类:
系统相关 时间:
2015-07-30 23:21:45
阅读次数:
250
题意:形如12345是我们要找的数,形如11是不合法的数,找出区间[a~b]里的合法数的个数,1
分析:预处理,枚举从1开始到i结束的区间的合法数的个数,然后输入一个区间就输出sum[b]-sum[a-1]即可。这里借助set工具,利用它的count()函数,枚举数i,判定它是否为合法的数,方法是取它的每一位,然后在set里对这一位计数,如果 !=0,说明set里已经有相同的数字了,那么这个数就...
分类:
其他好文 时间:
2015-07-30 21:28:41
阅读次数:
128
每天晚上自动检查更新#!/bin/sh#auto gamedown2 versionDATE=`/bin/date +%m%d`COUNT=`curl 'http://11.1.1.1/index.php?m=version&c=auto&a=zheng_count'`var=`expr $COUN...
分类:
系统相关 时间:
2015-07-30 18:31:44
阅读次数:
172
char *p,*start,*end,*temp,c; int count = 0,i =0 ; p = (char *)malloc(21 * sizeof(char)); printf("请输入要反转的字符串:\n"); while ((c = getchar() )!= '\n') ...
分类:
其他好文 时间:
2015-07-30 16:46:13
阅读次数:
108
1、查询表中重复数据。select
* from people
where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1)
2、删除表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断,只留有rowid最小的记录
...
分类:
数据库 时间:
2015-07-30 14:56:20
阅读次数:
142
#include
#include
#include
#include
#include
#define BUFF_SIZE 10
char buffer[BUFF_SIZE];
char count = 0; //缓冲池里的信息数目
sem_t sem_mutex; //生产者和消费者的互斥锁
sem_t p_sem_mutex; //空的时候,对消费者不可进
sem_t c_sem...
分类:
其他好文 时间:
2015-07-30 13:37:50
阅读次数:
125
题目Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:
Given n = 13,
Return 6, because digit 1 occurred in the following n...
分类:
其他好文 时间:
2015-07-30 13:33:17
阅读次数:
141
[LeetCode] 038. Count and Say (Easy) (C++/Python)...
分类:
编程语言 时间:
2015-07-30 11:31:01
阅读次数:
286