码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
projecteuler---->problem=4----Largest palindrome product
title: Largest palindrome product Problem 4 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99. Find the l...
分类:其他好文   时间:2014-06-07 01:24:27    阅读次数:398
projecteuler---->problem=6----Sum square difference
title: The sum of the squares of the first ten natural numbers is, 12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)2 = 552 = 3025 Hence ...
分类:其他好文   时间:2014-06-05 12:03:29    阅读次数:243
Leetcode--Best Time to Buy and Sell Stock III
Problem Description: 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 two transa...
分类:其他好文   时间:2014-06-05 09:33:52    阅读次数:342
hdu 1863 畅通工程
题目:         链接:点击打开链接 题意:         中文题 算法: 思路:         赤裸裸的最小生成树。。 代码: #include #include using namespace std; struct node{ int u,v,w; } e[110]; int p[110]; int n,m,sum,ans; int cmp(node...
分类:其他好文   时间:2014-06-05 03:50:23    阅读次数:232
LeetCode:4Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note: ...
分类:其他好文   时间:2014-06-05 00:34:06    阅读次数:240
poj 3767 I Wanna Go Home
?? Description The country is facing a terrible civil war----cities in the country are divided into two parts supporting different leaders. As a merchant, Mr. M does not pay attention to politic...
分类:其他好文   时间:2014-06-05 00:16:43    阅读次数:266
hdu-4578-Transformation-线段树
当一道题目,使用__int64超时,使用int就能A的时候,我想,这个题,不是一个好题。。。。。 add[i]:记录加的lazy标记 mul[i]:记录乘的lazy标记 num[i]:记录数的lazy标记 sum[i][j]:第i段,j次方的和。 除去lazy标记的下放,这完全就是一道水的线段树的题目。。。 lazy标记如何下放呢? 1,首先查看num标记,如果存在,果断下放。 2...
分类:其他好文   时间:2014-06-04 21:41:27    阅读次数:343
【HDOJ】1394 Minimum Inversion Number
逆序数的性质。1. 暴力解 1 #include 2 3 #define MAXNUM 5005 4 5 int a[MAXNUM]; 6 7 int main() { 8 int n; 9 int i, j, sum, min;10 11 while (scanf(...
分类:其他好文   时间:2014-05-31 07:50:50    阅读次数:170
Aizu 1335 Equal Sum Sets
DescriptionLet us consider sets of positive integers less than or equal ton. Note that all elements of a set are different. Also note that the order o...
分类:其他好文   时间:2014-05-31 05:12:49    阅读次数:246
SRM 622 div1 250
Problem StatementIn the Republic of Nlogonia there are N cities. For convenience, the cities are numbered 0 through N-1. For each two different cities...
分类:其他好文   时间:2014-05-31 00:47:40    阅读次数:364
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!