码迷,mamicode.com
首页 >  
搜索关键字:代码题    ( 349个结果
Project-Euler problem 1-50
最近闲的做了下Project Euler 上的题目,前面50题都比较简单,简单总结下,一下代码一般是Python和C/C++的 用Python 做这些题目简直是酸爽啊 一下代码可能不一定是我的,因为不知道论坛里面的回复不是永久的,所以我的代码有的丢了,可能找个和我的意思相近的代码。题目翻译是从 欧拉计划 | Project Euler 中文翻译站上面Copy 的表告我。 Prob...
分类:其他好文   时间:2015-01-31 00:26:08    阅读次数:241
java统计一个子串在指定字符串中出现的次数
今天查着用了用String类里的几个方法,分享下代码题目要求:统计一个子串在指定字符串中出现的次数( 提示java字串出现了6次) 1 public class SearchSameString { 2 3 public static void main(String[] args) { ...
分类:编程语言   时间:2015-01-24 21:12:13    阅读次数:396
Pat(Advanced Level)Practice--1089(Insert or Merge )
Pat1089代码 题目描述: According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element ...
分类:其他好文   时间:2015-01-10 01:31:42    阅读次数:282
Pat(Advanced Level)Practice--1087(All Roads Lead to Rome)
Pat1087代码 题目描述: Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness. Input S...
分类:其他好文   时间:2015-01-10 01:31:07    阅读次数:245
Pat(Advanced Level)Practice--1090(Highest Price in Supply Chain)
Pat1090代码 题目描述: A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer. Starting from one root supp...
分类:其他好文   时间:2015-01-10 01:28:52    阅读次数:212
Pat(Advanced Level)Practice--1085(Perfect Sequence)
Pat1085代码 题目描述: Given a sequence of positive integers and another positive integer p. The sequence is said to be a "perfect sequence" if M Now given a sequence and a parameter p, you are s...
分类:其他好文   时间:2015-01-09 23:48:11    阅读次数:495
Pat(Advanced Level)Practice--1086(Tree Traversals Again)
Pat1086代码 题目描述: An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6...
分类:其他好文   时间:2015-01-09 23:45:43    阅读次数:201
[BZOJ 1042] [HAOI2008] 硬币购物 【DP + 容斥】
题目链接:BZOJ - 1042题目分析首先 Orz Hzwer ,代码题解都是看的他的 blog。这道题首先使用DP预处理,先求出,在不考虑每种硬币个数的限制的情况下,每个钱数有多少种拼凑方案。为了避免重复的方案被转移,所以我们以硬币种类为第一层循环,这样阶段性的增加硬币。一定要注意这个第一层循环...
分类:其他好文   时间:2014-12-24 21:25:52    阅读次数:136
void swap(int a,int b)这样一个函数原型能交换两个数么?可以!!
昨天在指导别人指针的时候,突发奇想想到这么一道题,我觉得挺有意思的,发给大家看看,虽然不是什么很高级的技术,但是是个很有趣的思路..... 题目就是: void swap(int a,int b)这个函数原型,不能用全局变量与静态变量的情况下,怎么实现交换两个数? 如果你有兴趣可以思考一下,如果没兴趣就直接看下面的答案吧。 -----------------------------...
分类:其他好文   时间:2014-12-11 22:27:11    阅读次数:170
POJ-1003&1004
这两题比较简单,就不做分析了,描述下题目,就上代码吧。 【题目描述】 1003,其实就是求这个方程的最小n:1/2 + 1/3 + 1/4 + ... + 1/(n + 1) >= c; 1004,其实就是算个平均数,直接除12 【附:完整代码】 1003题: /* POJ-1003 Hangove...
分类:其他好文   时间:2014-11-15 17:02:15    阅读次数:202
349条   上一页 1 ... 30 31 32 33 34 35 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!