题意:要从四个数组中各选一个数,使得这四个数之和为0,求合法的方案数。分析:首先枚举A+B所有可能的值,排序。然后枚举所有-C-D的值在其中用二分法查找。 1 #include 2 #include 3 using namespace std; 4 5 const int maxn = 400...
分类:
其他好文 时间:
2015-02-04 20:12:31
阅读次数:
106
这道题其实挺简单的,因为只看最后一位,所以就讨论最后一位的情况就可以了。而最后一位显然是有周期性的。
#include
#include
#include
#include
#include
using namespace std;
int main()
{
int a,b,mode[12];
while(scanf("%d%d",&a,&b)!=EOF)
{
...
分类:
其他好文 时间:
2015-02-04 18:39:20
阅读次数:
105
#include #include using namespace std; #define MAXSIZE 100
typedef int ElemType;
/*线性表的静态链表存储结构*/
typedef struct { ElemType data; int cur;//为0时表示没有后继的...
分类:
其他好文 时间:
2015-02-04 18:38:23
阅读次数:
121
using AnfleCrawler.Common;using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Anf...
分类:
其他好文 时间:
2015-02-04 18:20:53
阅读次数:
175
如果直接利用二叉树的层序是没有办法构建一个二叉树的,但是如果是完全二叉树应该是可以的
这里层序序列中用-1表示当前节点没有值
构建主要采用了非递归的方法,利用了queue,因为层序的遍历可以通过queue来实现那么自然也可以通过这个方法进行构建
#include
#include
#include
using namespace std;
typedef struct T...
分类:
其他好文 时间:
2015-02-04 16:38:19
阅读次数:
166
#include
using namespace std;
int main()
{
int a[] = {1,-1,3,-7,10,-3,6,-8,1};
int size = sizeof(a)/sizeof(int);
int curSum = 0;
int maxSum = a[0];
for(int i=0;i<size;i++){
...
分类:
编程语言 时间:
2015-02-04 16:36:04
阅读次数:
163
1、接口using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace PlugDemo{ public interface IPlugToText { ...
题目大意:维护一棵有根树,每个节点初始权值为0,支持下列操作:
1.链上+
2.子树求和
。。。。。链剖裸题- -
果然链剖这种东西想要1A实在是不咋现实- -
#include
#include
#include
#include
#define M 100100
using namespace std;
struct Segtree{
Segtree *ls,*rs;
l...
分类:
其他好文 时间:
2015-02-04 14:49:21
阅读次数:
143
功能:翻转字符串 ,翻转数组, 用于STL的翻转。
头文件:
例子:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
char s[100];...
分类:
其他好文 时间:
2015-02-04 14:42:11
阅读次数:
88
要播放视频其实和显示图像一样简单,只要考虑播放视频的时候如何循环地顺序读取视频中的每一帧,并且怎么退出该循环。
由一般看视频经验知道,当我们按ESC(ASCII=27)键就可以退出播放。
另外就是加入控制条,控制视频播放进度。可以考虑记录该段视频的总帧数,然后跳到指定帧的位置,继续读取下一帧。#include
#include
using namespace std;
using nam...
分类:
其他好文 时间:
2015-02-04 14:37:49
阅读次数:
184