http://soj.sysu.edu.cn/show_problem.php?pid=1000&cid=1762这题的n达到了1000000,n^2的最长递增子序列做法肯定超时,于是有一种二分的算法,与此题完美地结合起来!达到nlogn的时间复杂度! 1 /* 2 最长递增子序列+二分查找 3 ....
分类:
其他好文 时间:
2015-03-29 12:15:33
阅读次数:
186
直接用递归做了一下,超时了,可能要再加上记忆化搜索?不会...然后再用动态规划就过了...http://soj.sysu.edu.cn/show_problem.php?pid=1002&cid=1762 1 //直接递归,tle 2 #include 3 #include 4 #include.....
分类:
其他好文 时间:
2015-03-29 10:37:51
阅读次数:
133
分数排名查询
总提交数量:
641
通过数量:
239
时间限制:1秒 内存限制:256兆
题目描述
张老师在同学们考试结束后,收到很多邮件。
有的同学问学号为“12号”的多少分...
分类:
其他好文 时间:
2015-03-17 14:15:48
阅读次数:
179
Output the Yanghui triangel
总提交数量:
225
通过数量:
59
时间限制:1秒 内存限制:256兆
题目描述
Write program to o...
分类:
其他好文 时间:
2015-03-16 16:23:22
阅读次数:
134
背景:这题做了大概五个小时,每次都在标记上出错。
思路:回溯,我先把军舰的长度按照由长到短依次排列,然后依次检索,特别注意变量l的使用,正是这个变量的使用,我的一段混乱代码才可以过。
题目中的数据很容易过,如果实在找不出错误,又不知道如何出数据,可以把第一组和第二组数据结合起来(一般人我不告诉他,哈哈)。代码如下,请自行理解。
学习:回溯算法:从一条路往前走,能进则进...
分类:
其他好文 时间:
2015-03-02 23:57:34
阅读次数:
370
背景:没考虑到海拔还可以为0和负,所以就一直wrong了好久。
思路:dfs+记忆化搜索+递归。
学习:记忆化搜索。#include
#include
using namespace std;
int area[52][52],memory[52][52];
int m,n,max_time,k;
int judge(int i1,int j1,int i,int j)
{
if(...
分类:
其他好文 时间:
2015-02-22 17:23:05
阅读次数:
148
12985. Sum Fun
限制条件
时间限制: 1 秒, 内存限制: 256 兆
题目描述
Given a list of 3 positive integers, it may or may not be true that one of those numbers is the sum of the other two. Given several such sets o...
分类:
其他好文 时间:
2015-02-17 10:24:51
阅读次数:
172
Time Limit: 5000 MS Memory Limit: 65536 K
Description
A positive integer is said to be squarefree if it is divisible by no perfect square larger than 1.
For example, the first few squarefree ...
分类:
其他好文 时间:
2015-02-13 13:25:35
阅读次数:
184
背景:由于对map使用的不熟悉,先一直无法编译通过,当纠正了map的错误后,一次ac。
思路:先用map对每个怪物需要消耗的子弹和一个怪物会伤害人多少血进行映射,然后就是简单模拟了。
学习:map的简单使用。#include
#include
using namespace std;
map xue,zidan;
int l,a;
void judge(char guaiwu,int g_...
分类:
其他好文 时间:
2015-02-13 10:11:58
阅读次数:
236
背景:wrong在几组坑数据上,如果不看discuss,打死我也想不出来还有那些坑数据,o(︶︿︶)o 唉。
思路:用数组存储那个数字,然后进行想加,相加的时候记住取余和取整运算,还得注意几组特别坑的数据,这里提供几组坑数据。
0000 0000 99 1 001245 1000
学习:了解用数组去存储一个大数。
#include
#include
void Sum(in...
分类:
其他好文 时间:
2015-02-06 23:15:37
阅读次数:
166