Description
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal lengt...
分类:
其他好文 时间:
2015-03-30 16:36:02
阅读次数:
117
题意:
题目意思很明朗~
思路:
A(n+1)=F(n+1)*(n+1)^k
A(n)=F(n)*(n)^k
A(n-1)=F(n-1)*(n-1)^k
这里拿k=2来举例
A(n+1)=F(n)*(n+1)^2+F(n-1)*(n+1)^2
对于A(n+1)发现可以由A(n)和A(n-1)得到
实际上就是多了 2*n+1个F(n) 和4*n个F(n-1)
其实就是n^k ->...
分类:
其他好文 时间:
2015-03-30 16:31:26
阅读次数:
159
题意:有n行含m个元素序列,从每行取一个数得到他们的和,一共可以得到m^n个和。输出前n个最小的和。
思路:可以用优先队列递归解决,当只取前两行的数,得到两个数的和的前n小的序列。这个序列就相当于把第一行和第二行合并,再解决n-1行的子问题。
用优先队列解决的时候也有点小技巧,类似尺取法。
//236 KB 563 ms C++ 1480 B
#include
#include
#incl...
分类:
其他好文 时间:
2015-03-30 13:28:22
阅读次数:
151
join() 方法用于将序列中的元素以指定的字符连接生成一个新的字符串。str.join(sequence)>>> str = ''>>> seq = ['abc','def']>>> print str.join(seq)abcdef>>> str = '-'>>>seq=('abc','def'...
分类:
编程语言 时间:
2015-03-30 12:58:50
阅读次数:
202
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For e...
分类:
其他好文 时间:
2015-03-30 12:46:51
阅读次数:
155
9562. SUME
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
Once upon a time, there existed a sequence A consisting of N positive integers. You don't know the sequenc...
分类:
其他好文 时间:
2015-03-30 09:18:21
阅读次数:
110
SubsequenceTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 9236Accepted: 3701DescriptionA sequence of N positive integers (10 2 #include 3 .....
分类:
其他好文 时间:
2015-03-29 19:29:16
阅读次数:
175
练习3-81原文“random” numbers. Produce a stream formulation of this same generator that operates on an input stream of requests to generate a new random number or to reset the sequence to a specified value...
分类:
其他好文 时间:
2015-03-29 16:37:04
阅读次数:
151
序列:创建一个序列 create SEQUENCE dept_deptno increment by 1 //自增数 start with...
分类:
数据库 时间:
2015-03-29 14:56:44
阅读次数:
143
题意:给你一个序列a[i],代表 i这个数 在b数列中有多少个值在它前面且比它大,问你求B序列解题思路:线段树的简单应用,找第几个空,类似二分。解题代码: 1 // File Name: i.cpp 2 // Author: darkdream 3 // Created Time: 2015年...
分类:
其他好文 时间:
2015-03-29 10:43:46
阅读次数:
108