前面总结了leecode上,改为成3出现,只有1个出现1次,的是通过记录每个位的个数来实现的如果count%3=1则为1,否则为0,实现起来充分利用了位运算。编程之美上的,没有写过,今天写一下。http://blog.csdn.net/morewindows/article/details/8214...
分类:
其他好文 时间:
2014-07-03 10:33:52
阅读次数:
220
#include #include #include #include class semaphore{unsigned int count_;boost::mutex mutex_;boost::condition_variable condition_;public:explicit sema....
分类:
其他好文 时间:
2014-07-01 22:03:34
阅读次数:
474
$values = array(array(1,2),array(3,4),array(5,6),);$nbValues = count($values);$sql = 'INSERT INTO table_name (col_name1, col_name2) VALUES ';for ($i=0...
分类:
其他好文 时间:
2014-07-01 21:28:51
阅读次数:
226
聚合函数:SQL中提供的聚合函数可以用来统计、求和、求最值等等。分类:–COUNT:统计行数量–SUM:获取单个列的合计值–AVG:计算某个列的平均值–MAX:计算列的最大值–MIN:计算列的最小值首先,创建数据表如下:执行列、行计数(count):标准格式SELECT COUNT() FROM 其...
分类:
数据库 时间:
2014-07-01 18:05:59
阅读次数:
234
前段时间发布的系统(Oracle+weblogic)频繁挂掉,每天早上9点、下午2点高峰期就挂,纠结了很长时间,最终解决,方法描述下。执行select count(*),status from v$session group by status;指令,发现不活动连接数比较大,当上升到一定数值之和,就...
分类:
数据库 时间:
2014-07-01 16:37:13
阅读次数:
243
#includevoid main(){const int count = 5;//定义数量struct student{char name[80];float math,eng;float aver;}stu[count],temp;//输入for (int i = 0; i stu[sub].a...
分类:
编程语言 时间:
2014-07-01 13:32:56
阅读次数:
257
A过去后看了一下别人的解法,发现除了打表还有一种数论的方法。分析一下阶乘后面的0是怎么出现的呢,当然是2乘5得到的。我们将1~N先放在一个数组里面。从数组第一个元素开始,先统计一下N!中因子为5的个数记为count,将其除去,然后再除去count个2。这样一来的话把所有元素乘起来后就不会出现10的倍...
分类:
其他好文 时间:
2014-07-01 10:23:40
阅读次数:
328
题目描述:
长度为L个单位的画板,有T种不同的颜料,现要求按序做O个操作,操作分两种:
1.“C A B C”,即将A到B之间的区域涂上颜色C
2.“P A B”,查询[A,B]区域内出现的颜色种类
出现操作2时,请输出答案
PS:初始状态下画板颜色为1
一开始没有想那么好,用int整型位移来代替颜色,还是使用了最传统的bool color[来记录,可是不知道错在了哪里,
...
分类:
其他好文 时间:
2014-07-01 07:25:22
阅读次数:
240
Swift 中的方法是与特定类型(类和结构体)相关的函 数。实例方法 隶属于某个特定类型(类或结构体)实例函数。 class Counter{var count = 0funcincrement() {count++}funcincrementBy(amount: Int) {count += amount}func reset() {count = 0}}let counter = Counte...
分类:
其他好文 时间:
2014-06-30 20:22:51
阅读次数:
301
源程序:
#include
#include
using namespace std;
int main()
{
int n;char buffer[6];
int count=0;
int len;
cin>>n;
for(int i=1;i<=n;i++)
{
if((i%7)==0)count++;
else
{
itoa(i,buffer,10);
...
分类:
其他好文 时间:
2014-06-30 20:16:38
阅读次数:
246