- 浏览: 1407361 次
- 性别:
- 来自: 火星
-
文章分类
最新评论
-
aidd:
内核处理time_wait状态详解 -
ahtest:
赞一下~~
一个简单的ruby Metaprogram的例子 -
itiProCareer:
简直胡说八道,误人子弟啊。。。。谁告诉你 Ruby 1.9 ...
ruby中的类变量与类实例变量 -
dear531:
还得补充一句,惊群了之后,数据打印显示,只有一个子线程继续接受 ...
linux已经不存在惊群现象 -
dear531:
我用select试验了,用的ubuntu12.10,内核3.5 ...
linux已经不存在惊群现象
地址在下面,都是些有趣的数学题,有兴趣的可以去玩玩.
http://www.projecteuler.net
呵呵我刚做完前10题,以后每做完10题都会发到我博客上。
PS:我用的是python和c写的。
1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
2
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Find the sum of all the even-valued terms in the sequence which do not exceed one million.
3
4
5
6
7
8
9
10
http://www.projecteuler.net
呵呵我刚做完前10题,以后每做完10题都会发到我博客上。
PS:我用的是python和c写的。
1
引用
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
def find(): return reduce(lambda x,y:x+y,[x for x in xrange(3,1000) if not x%3 or not x%5]) print find()
2
引用
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
Find the sum of all the even-valued terms in the sequence which do not exceed one million.
import itertools def Fibonacci(): x, y = 1,2 while True: if x%2==0: yield x x, y = y, x + y print reduce(lambda x,y:x+y,itertools.takewhile(lambda x:x<1000000,Fibonacci()))
3
引用
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 317584931803?
What is the largest prime factor of the number 317584931803?
#include <stdio.h> void main() { __int64 n=317584931803; __int64 i; for(i=2;i<=n;i++) { while(n!=i){ if(n%i==0){ n=n/i; } else break; } } printf("%d",n); }
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 largest palindrome made from the product of two 3-digit numbers.
Find the largest palindrome made from the product of two 3-digit numbers.
#include <stdio.h> #include <string.h> #include <stdlib.h> void main( ) { char xy[7]; int str,half,flag; for(int i=998001;i>10000;i--){ itoa(i,xy,10); str=strlen(xy); half=str/2; for(int j=0;j<half;j++){ if(xy[j]!=xy[--str]) break; else if(j==half-1) for(int k=100;k<1000;k++){ int tmp=i/k; int tmp2=i%k; if(tmp2==0&&99<tmp&&tmp<1000){ printf("%d=%d*%d",i,tmp,k); flag=1; break; } } } if(flag==1) break; } }
5
引用
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?
What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?
#include <stdio.h> int pub(int i,int j); void main(){ int result=2; int i=3; while(true){ if(i>19) break; int tt=pub(result,i); result=result*i/tt; i+=1; } printf("%d\n",result); } int pub(int i,int j) { int temp; if(i<j){ int tmp=i; i=j; j=tmp; } while(true){ temp=i%j; if(temp==0) break; else{ i=j; j=temp; } } return j; }
6
引用
The sum of the squares of the first ten natural numbers is,
1² + 2² + ... + 10² = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)² = 55² = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
1² + 2² + ... + 10² = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)² = 55² = 3025
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 385 = 2640.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
def deff(): return sum(xrange(1,101))**2-reduce(lambda x,y: x+y,[x**2 for x in xrange(1,101)]) print deff()
7
引用
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10001st prime number?
What is the 10001st prime number?
import itertools def pre( ): D = { } yield 2 for q in itertools.islice(itertools.count(3), 0, None, 2): p = D.pop(q, None) if p is None: D[q*q] = q yield q else: x = p + q while x in D or not (x&1): x += p D[x] = p print list(itertools.islice(pre(),100001))[10000]
8
引用
Find the greatest product of five consecutive digits in the 1000-digit number.
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
66896648950445244523161731856403098711121722383113
62229893423380308135336276614282806444486645238749
30358907296290491560440772390713810515859307960866
70172427121883998797908792274921901699720888093776
65727333001053367881220235421809751254540594752243
52584907711670556013604839586446706324415722155397
53697817977846174064955149290862569321978468622482
83972241375657056057490261407972968652414535100474
82166370484403199890008895243450658541227588666881
16427171479924442928230863465674813919123162824586
17866458359124566529476545682848912883142607690042
24219022671055626321111109370544217506941658960408
07198403850962455444362981230987879927244284909188
84580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450
def find(): a="""73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648950445244523161731856403098711121722383113 62229893423380308135336276614282806444486645238749 30358907296290491560440772390713810515859307960866 70172427121883998797908792274921901699720888093776 65727333001053367881220235421809751254540594752243 52584907711670556013604839586446706324415722155397 53697817977846174064955149290862569321978468622482 83972241375657056057490261407972968652414535100474 82166370484403199890008895243450658541227588666881 16427171479924442928230863465674813919123162824586 17866458359124566529476545682848912883142607690042 24219022671055626321111109370544217506941658960408 07198403850962455444362981230987879927244284909188 84580156166097919133875499200524063689912560717606 05886116467109405077541002256983155200055935729725 71636269561882670428252483600823257530420752963450 """ result=1 f=a.replace("\n","") for i in xrange(0,len(f)-4): tmp= reduce(lambda x, y: int(x)*int(y), f[i:i+5]) if result<tmp: result=tmp return result print find()
9
引用
A Pythagorean triplet is a set of three natural numbers, a<b<c, for which,
a² + b² = c²
For example, 3² + 4² = 9 + 16 = 25 = 5².
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
a² + b² = c²
For example, 3² + 4² = 9 + 16 = 25 = 5².
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
#include <stdio.h> void main() { for(int i=2;i<1000;i++) { for(int j=i+1;j<1000;j++) if(i*i+j*j==(1000-i-j)*(1000-i-j)) printf("%d\n",i*j*(1000-j-i)); } }
10
引用
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below one million.
Find the sum of all the primes below one million.
import itertools def pre( ): D = { } yield 2 for q in itertools.islice(itertools.count(3), 0, None, 2): p = D.pop(q, None) if p is None: D[q*q] = q yield q else: x = p + q while x in D or not (x&1): x += p D[x] = p print sum(list(itertools.takewhile(lambda x:x<1000000,pre())))
发表评论
-
Python3K Alpha1放出
2007-09-01 00:47 2221详细情况请看这里: http://python.org/do ... -
py3000的一些信息
2007-07-31 20:09 2726原文看这里 http://www.artima.com/web ... -
Python 3000 Status Update
2007-06-19 19:23 2211http://www.artima.com/weblogs/v ... -
操作符is的1个诡异问题
2007-06-13 09:44 2929请看这段程序 a = 0 b = 0 while a ... -
python之父要来北京了。
2007-04-13 10:01 3577May 31 is Google Developer Day ... -
今天Python2.5.1release了
2007-04-12 10:06 2434http://www.python.org/download/ ... -
Peter Norvig用python写的拼写纠错
2007-04-11 10:19 3595文章在这里: http://www.norvig.com/sp ... -
今天发现了一个非常有意思的regex
2007-03-20 10:24 2717判断一个数是否为质数的方法: import re de ... -
这里有个讲Fp的文章,讲的很是有趣.
2007-03-13 14:31 3740http://chn.blogbeta.com/232.htm ... -
python中的Error-checking策略
2007-03-02 21:12 4356参考 python in nutshe ... -
关于类中slots属性的用法的疑问
2007-02-28 10:07 4675__slots__保存着实例变量的列表,并且在实例中保留空间以 ... -
python中是否可以实现'tail-call elimination'的优化
2007-02-13 16:49 9553今天看 python in nutshell 时看到了这段 ... -
Jython Beta and 2.2 发布了
2007-02-09 21:26 4073本以为已经挂了,今天无意中去逛了一下,竟然更新了,而且看了它的 ... -
python 中古怪的input()错误(已解决)
2006-11-23 15:15 7729在windows下 width = input('Pleas ...
相关推荐
public class ProJectEulerProblem3 { private static String str = "600851475143"; private static BigInteger date = new BigInteger(str); public static void main(String[] args) { long start = System....
一、ERA5数据下载,deepseek提问全图
UE5 MQTT通信插件
【vue】基于 Vue3 + Element Plus 实现,支持 RBAC 动态权限、数据权限、SaaS 多租户、Flowable 工作流、三方登录、支付、短信、商城、CRM 等功能_pgj
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
该项目为基于C#语言的智能诊断交付系统插件设计源码,总计包含122个文件,涉及多种类型,包括70个元数据文件、26个C#源代码文件、6个预制体文件、5个材质文件、3个着色器文件、3个Unity脚本文件、2个汇编定义文件、1个Cginc文件、1个Markdown文件、1个光照文件。该系统专注于智能诊断交付,旨在提升诊断交付的效率和准确性。
内容概要:本文探讨了一个经典的数组操作问题——在一个已经排序的数组中去除多余的重复元素,确保每个元素最多出现两次。该问题要求算法在原地执行(不引入新的数据结构),并且仅消耗O(1)的额外存储空间。文中详细展示了问题的要求与挑战,给出具体的示例帮助理解,并明确指出了解题思路和预期效果。 适用人群:面向有一定编程经验的学习者或者初涉Python开发的语言爱好者,尤其是对算法有兴趣的人群。 使用场景及目标:适用于那些希望提升自己数据处理技巧,特别是有关列表、数组的操作技能的人。该方法可以在内存有限的情况下进行高效的去重处理,比如嵌入式系统或者大规模数据分析环境。 其他说明:该算法主要运用双指针(快慢指针)的方法,在遍历数组的同时实现对原始数据的部分覆盖来达到减少重复项目的目的,同时也提醒使用者注意'引用'特性可能引起的潜在误解。
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
深海沉积物岩心GeoB17603-2的文档记录 内容 该文献由Lucchi RG、Sabbatini A、Nicolaisen LS等人于2014年发布,主要描述了深海沉积物岩心GeoB17603-2的相关信息。具体内容涉及岩心的采集情况及其详细特征等。读者可通过访问"此链接" ()获取更多关于该数据集的信息。遗憾的是,目前尚未提供该数据集的具体大小。
本项目为Node.js学习资源集,包含41个文件,涵盖26个JavaScript文件、4个HTML文件、3个JSON文件、3个文本文件、2个Markdown文件、1个Git忽略文件、1个PNG图像文件、1个TypeScript文件。内容丰富,涉及Node.js学习的各个方面,旨在帮助开发者掌握相关技能。
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
本项目是一个基于Vue框架和JavaScript的前端样式设计源码,专注于实现图片对比效果,通过input range控件实现风格切换。该项目包含87个文件,其中SVG文件48个,JavaScript文件16个,Vue文件8个,JPG图片文件5个,JSON文件3个,开发配置文件1个,生产配置文件1个,Git忽略文件1个,Markdown文件1个,HTML文件1个。项目适用于需要展示和比较不同图片风格的场景。
MAX30102心率血样传感器原理图
资源名称:Python—Excel选表头列key-value-转json文件 类型:windows—exe可执行工具 环境:Windows10或以上系统 功能: 1. 点击按钮【选择文件】:选择一个Exel文件(默认第一行为表头) 2. 点击选择key列(可多选-多个中间用“=”隔开) 3. 点击选择value列(可多选-多个中间用“=”隔开) 4. 点击按钮【选择文件】:保存路径 5. 点击按钮【转换并保存】:保存路径 优点: 1、非常快的速度! 2、已打包—双击即用!无需安装! 3、自带GUI界面方便使用!
该项目是一个个人作品集设计源码,采用HTML、JavaScript和CSS技术构建,包含50个文件,其中包括12个HTML文件、10个JavaScript文件、9个JPG图片文件、6个PNG图片文件、4个CSS样式表文件、3个SVG矢量图形文件、以及各种字体文件,如EOT、TTF、WOFF和WOFF2等。该作品集旨在展示个人设计作品,适合个人网站或在线展示使用。
该项目是一款基于C语言核心开发,并融合HTML、CSS、Python等多语言技术的智能仓储安防控制系统源码。项目包含360个文件,其中225个为头文件(.h),32个为C语言源文件(.c),27个为压缩文件(.gz),8个为共享库文件(.so),7个为静态库文件(.a),6个为配置文件(.1, .pc, .cmake)和3个XML文件(.xml)。该系统旨在提供智能化的仓储安防解决方案。
鱼码grant.dll是一个简单易用的标准DLL,让软件开发者快速为自己软件加上注册码,支持在线和离线授权,实现商用授权许可。鱼码可以让开发者快速为自己软件加上软件升级功能 软件托管,0成本搭建平台,在线销售自己软件,管理授权码。 dll使用说明可进入演示地址进行查看。 安装: 1、下载dll注册成开发者 2、调用dll里check_grant函数 3、会员中心管理自己授权码发放或过期、删除等操作 软件有vb、vb.net、vc、vc.net、易语言和Delphi示例,压缩包中的为vb.net的,如果需要其他版本的demo请到官网进行下载。
乡村小道图像分割系统:智能化检测
内容概要:本文介绍了新碧彩SaaS平台项目的特点及其建设优势。新碧彩SaaS平台采用了云托管方式部署,利用微服务架构进行业务拓展,统一接口管理和多租户模式以降低运营成本、提高灵活性。通过集群部署及专业的运维团队,保障租户使用的稳定性、安全性、高效率。平台实现了采购业务全流程的规范化管理及优化。同时支持快速扩展各类业务应用,包括财务管理、办公自动化、人力资源等多个方面。 适合人群:对于物业公司或其他相关行业的技术人员、管理者及关注企业数字化转型的从业者。 使用场景及目标:①解决现有采购管理系统难以适应快速增长的企业规模和发展需求的问题;②通过引入新技术提升管理水平和服务质量;③实现业务处理流程化、数据化的目标,并能轻松对接第三方服务商的数据接口服务。 其他说明:本文详细阐述了如何借助现代化信息技术手段,助力企业转型升级为智能型企业,特别是在当前中国物业管理市场背景下尤为重要。此外还提到平台未来可能会继续围绕用户体验改进功能特性,如提供更多增值服务等。