随笔分类 - Code_4h_everyday
I hope one years later I can say to myself that I have completed 1000 hour coding during the year,Come on ,Lin Hongxin.
摘要:关于vector的capacity和size 在vector中,size表示当前vector数组的长度,即现在含有元素数量,而capacity则指的是在当前vector还没有重新分配空间前你最大容量。 resize和reserve resize(n)代表将vector的size限定为n,即如果原来v
阅读全文
摘要:class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ length=len(nums) nums=sorted(nums) ...
阅读全文
摘要:class Solution(object): def maxArea(self, height): """ :type height: List[int] :rtype: int """ length=len(height) left=0 right=length-1 ...
阅读全文
摘要:class Solution(object): def merge(self, nums1, m, nums2, n): """ :type nums1: List[int] :type m: int :type nums2: List[int] :type n: int :rtype: vo...
阅读全文
摘要:class Solution(object): def deleteDuplicates(self, head): """ :type head: ListNode :rtype: ListNode """ tmp=head while tmp: while tmp.n...
阅读全文
摘要:Description You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct way
阅读全文
摘要:Problem Description "One thing is for certain: there is no stopping them;the ants will soon be here. And I, for one, welcome our new insect overlords.
阅读全文
摘要:题目描述: 在一个周长为10000的圆上等距分布着n个雕塑。现在又有m个新雕塑加入(位置可以随意放),希望所有n+m个雕塑在圆周上均匀分布。这就需要移动其中一些原有的雕塑。要求n个雕塑移动的总距离尽量小。 输入格式: 输入包含若干组数据。每组数据仅一行,包含两个整数n和m(2<=n<=1000, 1
阅读全文
摘要:题目描述: 圆 桌旁坐着n个人,每人有一定数量的金币,金币总数能被n整除。每个人可以给他左右相邻的人一些金币,最终使得每个人的金币数目相等。你的任务时求出被转手 的金币数量的最小值。比如,n=4,且4个人的金币数量分别为1,2,5,4时,只需转移4枚金币(第3个人给第2个人两枚金币,第2个人和第4个
阅读全文
摘要://UVA 11292 #include #include using namespace std; const int maxiter=20001; int dra[maxiter],qi[maxiter]; int main() { int n,m; while(scanf("%d%d",&n,&m)==2&&n&&m) { for(int i=0;i=dra[i]) { ...
阅读全文

浙公网安备 33010602011771号