题目:Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onl...
分类:
其他好文 时间:
2015-06-09 00:45:04
阅读次数:
115
我第一个多线程程序,先贴代码,明天再来详细的写:// MultiThread.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#includeusing namespace std;DWORD WINAPI Thread1(LPVOID lpPara...
分类:
编程语言 时间:
2015-06-09 00:41:47
阅读次数:
149
联合权值(link.cpp/c/pas)【问题描述】无向连通图G有n个点,n-1条边。点从1到n依次编号,编号为i的点的权值为Wi,每条边的长度均为1。图上两点(u,v)的距离定义为u点到v点的最短距离。对于图G上的点对(u,v),若它们的距离为2,则它们之间会产生Wu×Wv的联合权值。请问图G上所...
分类:
其他好文 时间:
2015-06-09 00:41:25
阅读次数:
282
Problem Description
“今年暑假不AC?”
“是的。”
“那你干什么呢?”
“看世界杯呀,笨蛋!”
“@#$%^&*%...”
确实如此,世界杯来了,球迷的节日也来了,估计很多ACMer也会抛开电脑,奔向电视了。
作为球迷,一定想看尽量多的完整的比赛,当然,作为新时代的好青年,你一定还会看一些其它的节目,比如新闻联播(永远不要忘记关心国家大事)、非常6+7、...
分类:
其他好文 时间:
2015-06-08 23:31:43
阅读次数:
396
生活大爆炸版石头剪刀布(rps.cpp/c/pas)【问题描述】石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头。如果两个人出拳一样,则不分胜负。在《生活大爆炸》第二季第8集中出现了一种石头剪刀布的升级版游戏。升级版游戏在传统的石头剪刀布游戏的基础上,增加了两个新手势:斯波克:《星际迷航》...
分类:
其他好文 时间:
2015-06-08 23:16:40
阅读次数:
209
从windows角度来说,condition_variable类似event。阻塞等待出发,不过condition_variable可以批量出发。代码如下:// 1111111.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #i...
分类:
编程语言 时间:
2015-06-08 23:13:47
阅读次数:
232
题目:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-n...
分类:
其他好文 时间:
2015-06-08 19:23:30
阅读次数:
140
题目:Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S="ADOBECOD...
??
变量和基本类型
七、枚举
枚举不但定义了整数常量集,而且还把它们聚集成组; 枚举与简单的const常量相比孰优孰劣, 通过下面一段代码, 一看便知:
[cpp]
view plaincopyprint?
enum {input, output, append}; const int input = 0; const int out...
分类:
编程语言 时间:
2015-06-08 15:04:40
阅读次数:
159
??
变量和基本类型
四、const限定符
[cpp]
view plaincopyprint?
#include int main() { //for循环语句存在两个问题 for (int index = 0;index != 512; ++index) { //... } ...
分类:
编程语言 时间:
2015-06-08 15:04:25
阅读次数:
190