码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
ProjectEuler 006题
题目:The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten natural numbers is,(1 + ...
分类:其他好文   时间:2014-05-26 02:15:16    阅读次数:216
52. 不用+、-、×、÷做加法[add two numbers without arithmetic]
add two numbers without arithmetic
分类:其他好文   时间:2014-05-26 01:25:43    阅读次数:224
统计字符次数
输入一个字符串(长度在100以内),统计其中数字字符出现的次数。样例输入Ab100cd200样例输出6#include"stdio.h"int main(){ char a[100]; int i; int sum=0; scanf("%s",a); for(i=0;...
分类:其他好文   时间:2014-05-26 00:09:23    阅读次数:193
为王菲写的第五首歌《战斗》程序员之歌
战斗 懵懂的少年,不懂学习,整天旷课逃学,直到毕业 无意中成了村里伙伴唯一考上初中的,老人们说,厉害 上了初中还继续跟同学打架,老师批评,竟然落泪,然后老师说,你太小,留级 留级后黑暗中点日光灯,触电,怕怕,考试竟然进了班里的前三名 去重点高中!从此懂得了努力,第一次人生的战斗 在远离家乡的县城里,我看着眼花缭乱的游戏机,听到里面喊 three,two,one,zero,fight ...
分类:其他好文   时间:2014-05-25 12:50:32    阅读次数:188
POJ1753——Flip Game
Flip GameDescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is w...
分类:其他好文   时间:2014-05-25 03:21:52    阅读次数:255
LeetCode:3Sum
题目:         Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique  triplets in the array which gives the sum of zero. Note: Elements...
分类:其他好文   时间:2014-05-25 00:39:37    阅读次数:343
poj 3463 Sightseeing(最短路+次短路)
http://poj.org/problem?id=3463 大致题意:给出一个有向图,从起点到终点求出最短路和次短路的条数之和。 解法: 用到的数组:dis[i][0]:i到起点的最短路,dis[i][1]:i到起点的严格次短路 vis[i][0],vis[i][1]:同一维的vis数组,标记距离是否已确定 sum[i][0]:i到起点的最短路条数,sum[i][1]:...
分类:其他好文   时间:2014-05-24 21:50:31    阅读次数:287
2014百度之星资格赛——XOR SUM
2014百度之星资格赛——XOR SUM Problem Description Zeus 和 Prometheus 做了一个游戏,Prometheus 给 Zeus 一个集合,集合中包含了N个正整数,随后 Prometheus 将向 Zeus 发起M次询问,每次询问中包含一个正整数 S ,之后 Zeus 需要在集合当中找出一个正整数 K ,使得 K 与 S 的异或结果最大。P...
分类:其他好文   时间:2014-05-24 20:53:55    阅读次数:266
Leetcode的bug测试用例 ?? jump game
之所以说leetcode的测试用例有问题,是因为我刚开始理解错了题意,写下了如下的错误的代码。但是却AC了。 错误代码为: bool canJump(int A[], int n) { if(n == 0) return true; int sum = 0; //记录当前的最远距离 int i = 0; ...
分类:其他好文   时间:2014-05-24 19:45:57    阅读次数:1081
Light0J-1068 - Investigation
An integer is divisible by 3 if the sum of its digits is also divisible by 3. For example, 3702 is divisible by 3 and 12 (3+7+0+2) is also divisible by 3. This property also holds for the integer 9. ...
分类:其他好文   时间:2014-05-24 14:30:47    阅读次数:208
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!