原本觉得挺简单的,开始就一直RE,后来还T。。发现是服务器可能出问题了,老化了,时间变慢了,拿以前A掉的代码来都是T。
不过还是有快的方法的。
就是位运算。另外stl里也有现成的函数可以用nth_element(s,s+k-1,s+n);
但是还有一个问题,nth_element()换成自己写的就T。。无语了。。
大家快来指点一下啊~~~~
#include
#include
#incl...
分类:
其他好文 时间:
2015-04-07 09:51:43
阅读次数:
140
JavaScript使用Max函数返回两个数字中较大数的代码。JavaScript的Math对象带有一个max函数用于获取两个数字的较大数代码:<pid="demo">Clickthebuttontoreturnthehighestnumberof5and10.</p><buttonit</button><script>functionmyFunction(){documen..
分类:
编程语言 时间:
2015-04-06 18:56:18
阅读次数:
154
Remove Nth Node From End of ListTotal Accepted:46720Total Submissions:168596My SubmissionsQuestionSolutionGiven a linked list, remove thenthnode from ...
分类:
其他好文 时间:
2015-04-04 16:32:30
阅读次数:
113
Description73 88 1 02 7 4 44 5 2 6 5(Figure 1)Figure 1 shows a number triangle. Write a program that calculates the highest sum of...
分类:
其他好文 时间:
2015-04-02 22:33:22
阅读次数:
192
删除链表中倒数第n个节点,需要考虑的细节:链表为空时,链表只有一个节点时,n=1时。/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ...
分类:
其他好文 时间:
2015-04-02 20:50:41
阅读次数:
108
Find the nth to last element of a singly linked list. The minimum number of nodes in list is n.ExampleGiven a List 3->2->1->5->null and n = 2, return....
分类:
其他好文 时间:
2015-04-02 06:34:52
阅读次数:
101
Given a linked list, remove the nth node from the end of list and return its head.
For example,...
分类:
其他好文 时间:
2015-03-31 20:13:40
阅读次数:
140
一个进程中,主线程可以创建多个次线程。Thread oThread = new Thread(new ThreadStart(FuncA));oThread.Start();线程起始时启动的方法不能带有参数线程有5个优先级属性,由高到低分别是Highest,AboveNormal,Normal,Be...
分类:
编程语言 时间:
2015-03-31 17:30:00
阅读次数:
172
2.6 typedef 名字typedef可以用来定义类型的同义词例如:typedef double wages;//wages是double的同义词typedef int exam_score;//exam_score是int的同义词typedef wages salary;//这里就把wages...
分类:
其他好文 时间:
2015-03-31 17:18:16
阅读次数:
121
题目:Given a linked list, remove the nth node from the end of list and return its head.
For example:
Given linked list: 1->2->3->4->5, and n = 2.
After removing the second node from the end, ...
分类:
其他好文 时间:
2015-03-31 16:09:19
阅读次数:
128