Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in th ...
分类:
其他好文 时间:
2019-02-09 15:15:29
阅读次数:
169
我们看到过很多直线分割平面的题目,今天的这个题目稍微有些变化,我们要求的是n条折线分割平面的最大数目。比如,一条折线可以将平面分成两部分,两条折线最多可以将平面分成7部分,具体如下所示。 Input 输入数据的第一行是一个整数C,表示测试实例的个数,然后是C 行数据,每行包含一个整数n(0<n<=1 ...
分类:
其他好文 时间:
2019-02-09 10:17:15
阅读次数:
177
Codeforces Beta Round #22 (Div. 2 Only) http://codeforces.com/contest/22 A 水题 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt ...
分类:
其他好文 时间:
2019-02-08 18:26:48
阅读次数:
146
有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。 球赛的规则如下: 如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。 如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。 根据这个规则,无需循环较量,或许就能确 ...
分类:
其他好文 时间:
2019-02-08 10:17:40
阅读次数:
135
题目链接: https://vjudge.net/problem/19213/origin 大致题意: 一个滑雪者想知道自己在固定高度的山坡中最多能滑的距离是多少。 思路: 首先想到的就是dfs,但是。。超时了,所以我们要用到动态规划进行优化。 dfs的思路就是从第一个位置开始dfs搜索。 dp的思 ...
分类:
其他好文 时间:
2019-02-08 01:03:21
阅读次数:
211
The string type represents a string of Unicode characters. string is an alias for System.String in the .NET Framework. string is a reference type,obje ...
1.自底向上与自顶向下 //自底向上 #include<iostream> using namespace std; int f[101]; int main() { int n; f[1]=1; f[2]=1; while(cin>>n){ for(int i=3;i<=n;i++){ f[i]= ...
分类:
其他好文 时间:
2019-02-07 10:54:07
阅读次数:
327
二叉树时间复杂度的训练: T(n) = 2T(n/2)+o(n) nlogN 归并排序 快排:平均nlogN 最坏 n^2 树形展开法 T(N) = 2T(N/2)+O(1) o(n) 二叉树的时间复杂度= N*每个节点的处理时间 前序便利:根左右 中序 左根右 后序:左右根 DFS深度优先搜索:1 ...
分类:
其他好文 时间:
2019-02-07 09:31:06
阅读次数:
120
...applicationContext.xml] cannot be opened because it does not exist。 刚才在进行单元测试时,报这个错,我把它放到了src的某个包的下面了, 一般对于配置文件idea扫描的话是直接扫描src下,所以最好建个资源文件夹。 或者在单元 ...
分类:
编程语言 时间:
2019-02-05 23:50:34
阅读次数:
287
#include <iostream>#include <stdio.h>#include <stdlib.h>using namespace std; int main(){ FILE *fp; char ch; if((fp=fopen("123.txt","r"))==NULL) printf ...
分类:
编程语言 时间:
2019-02-03 23:53:42
阅读次数:
298