题目描述看到很短的题目会让人心情愉悦,所以给出一个长度为N的序列A1,A2,A3,…,AN,现在有M个询问,每个询问都是Ai…Aj中第k小的数等于多少。输入格式第一行两个正整数N,M。
第二行N个数,表示序列A1,A2,…,AN。
紧着的M行,每行三个正整数i,j,k(k≤j-i+1),表示询问Ai…Aj中第k小的数等于多少。输出格式共输出M行,第i行输出第i个询问的答案。样例输入1:
4 3...
分类:
其他 时间:
2015-04-07 10:01:58
收藏:
0 评论:
0 赞:
0 阅读:
121
Say you have an array for which the ith element is the price of a given stock on day
i.
Design an algorithm to find the maximum profit. You may complete at most
k transactions.
Note:
You may not ...
分类:
其他 时间:
2015-04-07 10:01:55
收藏:
0 评论:
0 赞:
0 阅读:
189
Eddy's picture
http://acm.hdu.edu.cn/showproblem.php?pid=1162
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 7521 Accepted Submission(...
分类:
其他 时间:
2015-04-07 10:01:34
收藏:
0 评论:
0 赞:
0 阅读:
216
sizeof是计算数据类型占用内存的大小。当计算字符串占存大小时。
sizeof(string)=strlen(string)+1;
原因很简单,string数组在存储时会补上最末位的‘\0’结束符。
举个例子:
#include
#include
int main()
{
char p[]="Tencent";
printf("%d\n",sizeof(p));
...
分类:
其他 时间:
2015-04-07 10:01:24
收藏:
0 评论:
0 赞:
0 阅读:
98
求一个数的所有因子和可以用算术基本定理,下面是它的两个重要应用:
(1)一个大于1的正整数N,如果它的标准分解式为: N=(P1^a1)*(P2^a2)......(Pn^an)
那么它的正因数个数为(1+a1)(1+a2).....(1+an)。
(2) 它的全体正因数之和为d(N)=(1+p1+...p1^an)(1+p2+...p...
分类:
其他 时间:
2015-04-07 10:01:19
收藏:
0 评论:
0 赞:
0 阅读:
212
uva 10739 String to PalindromeIn this problem you are asked to convert a string into a palindrome with minimum number of operations. The operations are described below:Here you’d have the ultimate free...
分类:
其他 时间:
2015-04-07 10:00:44
收藏:
0 评论:
0 赞:
0 阅读:
107
写在前面
我们都知道,在没有持久化存储的情况下,大部分的数据是存储在数组里面的,
也就是对应于数学中的矩阵,
对于一个矩阵而已,最重要的不外乎:赋值,操作,...
分类:
其他 时间:
2015-04-07 10:00:34
收藏:
0 评论:
0 赞:
0 阅读:
237
Tree
http://acm.hdu.edu.cn/showproblem.php?pid=2682
Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1855 Accepted Submission(s): 544
...
分类:
其他 时间:
2015-04-07 10:00:24
收藏:
0 评论:
0 赞:
0 阅读:
135
1.题目描述:点击打开链接
2解题思路:本题利用优先队列解决。本题在思维上需要稍微灵活变通一下:如果到达第i个加油站时,把它能够提供的油量预存储到队列中,等将来真正需要加油的时候,再从队列中取出来。这就等价于在到达第i个加油站时选择了加油的措施。不过本题要求加油次数最少。这时我们可以考虑使用STL中的优先队列解决。每次都选加油量最大的那个加油站来加油。这样的贪心选择可以保证最终的加油次数是最少的...
分类:
其他 时间:
2015-04-07 10:00:14
收藏:
0 评论:
0 赞:
0 阅读:
128
2014年2014年某月某日——开通CSDN博客,该博客至今(2015.4.6)访问仅9346次2015年02月03日——新开通CSDN博客,并进行博客搬家,旧博客至今(2015.4.6)访问仅9346次
02月10日——博客专栏的申请审核通过
03月23日——积分1500分,排名12565
03月25日——日访问量突破800
03月月底——专栏:SICP练习成为推荐专栏
04月04日——...
分类:
其他 时间:
2015-04-07 09:59:44
收藏:
0 评论:
0 赞:
0 阅读:
221
A sequence of numbers
http://acm.hdu.edu.cn/showproblem.php?pid=2817
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4046 Accepted Subm...
分类:
其他 时间:
2015-04-07 09:59:34
收藏:
0 评论:
0 赞:
0 阅读:
111
Primitive Roots
Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u
Submit Status Practice POJ
1284
Appoint description:
System Crawler (2015-04-06)
Descripti...
分类:
其他 时间:
2015-04-07 09:59:14
收藏:
0 评论:
0 赞:
0 阅读:
192
Binary Tree Right Side View
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom....
分类:
其他 时间:
2015-04-07 09:58:54
收藏:
0 评论:
0 赞:
0 阅读:
163
WHUgirls
Time Limit: 3000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 2251 Accepted Submission(s): 852
Problem Description
There are many...
分类:
其他 时间:
2015-04-07 09:58:34
收藏:
0 评论:
0 赞:
0 阅读:
90
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3706
题意:
给你两个标准重量的物体(质量为整数),你可以选择将其中一个分成两块(整数),求用这三个物体最多可以称出多少种重量。
其实一共就13种情况,数据量又比较小,用set排除一下重复的,注意下0就好。
代码:
#include ...
分类:
其他 时间:
2015-04-07 09:58:14
收藏:
0 评论:
0 赞:
0 阅读:
412
Case1:
#include
#include
#include
char* getMem(void)
{
char p[] = "hello world";//这样子定义可以输出,但输出乱码。
p[5] = 0x0;
return p;
}
int main()
{
char *s="fzz";
s=getMem();
pri...
分类:
其他 时间:
2015-04-07 09:58:04
收藏:
0 评论:
0 赞:
0 阅读:
214
socket咋谈
socket传输过程简单分解:
socket是网络编程接口,何为接口,任何两个物体,如果它们向通信交流就必须有接口,通过接口才能互相的传递数据信息,但是数据信息的传递,又必须遵循标准协议,比如你写一段中文的信发给一个美国老看,what a piece shit.于是又有了数据的协议必须用什么组织方式,是json,xml还是二进制块等等,分布在世界各地的主机要想...
分类:
其他 时间:
2015-04-07 09:57:44
收藏:
0 评论:
0 赞:
0 阅读:
253
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3712
题意:
一款游戏,高手玩家不会miss,得分至少为50。记分公式为P = Point * (Combo * 2 + 1),求最多得多少分,最低得多少分。
简单的贪心,贪心策略:最高分先50,再100,最后300。最低分反之即可。
...
分类:
其他 时间:
2015-04-07 09:57:14
收藏:
0 评论:
0 赞:
0 阅读:
95
Relatives
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d
& %I64u
Submit Status Practice POJ
2407
Appoint description:
System Crawler (2015-04-04)
Description
...
分类:
其他 时间:
2015-04-07 09:57:04
收藏:
0 评论:
0 赞:
0 阅读:
177
Flatten Binary Tree to Linked List
Given a binary tree, flatten it to a linked list in-place....
分类:
其他 时间:
2015-04-07 09:56:44
收藏:
0 评论:
0 赞:
0 阅读:
130