如图,给一个图,每个格子只能走一次,起点终点任意,求按路径顺序将格子里的数字拼在一起,最大的数字。 很容易想到用暴力求解的方法,但最多会有 30 个格子,O(2^30) 肯定超时了。 考虑剪枝,设当前已经找到一个 ans,若当前路径的最大长度小于 ans 的长度,则不可能比 ans 大,剪掉, 若等 ...
分类:
其他好文 时间:
2017-08-01 17:47:31
阅读次数:
152
Squirrel Liss lived in a forest peacefully, but unexpected trouble happens. Stones fall from a mountain. Initially Squirrel Liss occupies an interval ...
分类:
其他好文 时间:
2017-07-31 01:03:42
阅读次数:
236
参考文档 Python重定向标准输入、标准输出和标准错误 http://blog.csdn.net/lanbing510/article/details/8487997 python重定向sys.stdin、sys.stdout和sys.stderr http://www.cnblogs.com/g ...
分类:
编程语言 时间:
2017-07-30 22:00:07
阅读次数:
526
题目大意:你是一个战士现在面对,一群狼,每只狼都有一定的主动攻击力和附带攻击力。你杀死一只狼。你会受到这只狼的(主动攻击力+旁边两只狼的附带攻击力)这么多伤害~现在问你如何选择杀狼的顺序使的杀完所有狼时,自己受到的伤害最小。(提醒,狼杀死后就消失,身边原本相隔的两只狼会变成相邻,而且不需要考虑狼围城 ...
分类:
其他好文 时间:
2017-07-30 19:59:18
阅读次数:
146
( 1 )调用方式: gets( 字符数组 ) ( 2 )函数功能:从标准输入设备 (stdin) ──键盘上,读取 1 个字符串 (可以包 含空格) ,并将其存储到字符数组中去。 ( 3 )使用说明 1 ) gets() 读取的字符串,其长度没有限制,编程者要保证字符数组有足够大的 空间,存放输入 ...
分类:
编程语言 时间:
2017-07-30 15:50:20
阅读次数:
140
五个数比大小 #include<iostream> //#include<cstdio> using namespace std;int main (){ freopen("fivesort.in","r",stdin); freopen("fivesort.out","w",stdout); in ...
分类:
其他好文 时间:
2017-07-30 10:19:01
阅读次数:
140
#include<iostream> #include<cstdio> using namespace std; int main() { freopen("task.in","r",stdin) freopen("task.out","w",stout) int m,n; cin>>m>>n; i ...
分类:
其他好文 时间:
2017-07-30 10:03:06
阅读次数:
252
#include<iostream> #include<cstdio> using namespace std; int main() { freopen("task.in","r",stdin); freopen("task.out","w",stdout); int m,n; cin>>m>>n ...
分类:
其他好文 时间:
2017-07-30 00:09:57
阅读次数:
97
题目描述 给出N个正整数a[1..N],再给出K个关系符号(>、<或=)s[1..k]。选出一个长度为L的子序列(不要求连续),要求这个子序列的第i项和第i+1项的的大小关系为s[(i-1)mod K+1]。求出L的最大值。 给出N个正整数a[1..N],再给出K个关系符号(>、<或=)s[1..k ...
分类:
其他好文 时间:
2017-07-29 22:26:00
阅读次数:
226
>>> with open("login.txt","r+",ending="utf-8") as f: ...f.readline() File "<stdin>", line 2 f.readline() ^ IndentationError: expected an indented bloc ...
分类:
编程语言 时间:
2017-07-29 22:15:41
阅读次数:
1330