欧拉计划
aprilia车友 麒麟
这个作者很懒,什么都没留下…
展开
-
euler14
为正整数集合定义了以下迭代序列: n → n /2 ( n是偶数) n → 3 n + 1 ( n是奇数) 使用上面的规则并从 13 开始,我们生成以下序列: 13→40→20→10→5→16→8→4→2→1 可以看出,这个序列(从13开始到1结束)包含10项。虽然还没有被证明(Collatz 问题),但认为所有的起始数字都以 1 结束。 100 万以下的哪个起始数字产生最长的链? 注意:一旦链开始,条款就可以超过一百万。 The following iterative sequence is defi原创 2021-06-27 19:50:49 · 88 阅读 · 0 评论 -
euler8.cpp (滑动窗口)找出最大的乘积
1000 位数字中乘积最大的四个相邻数字是 9 × 9 × 8 × 9 = 5832。 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112949495459501737958331952853208805511 12540698747158523863050715693290963295227443043557 66896648原创 2021-06-27 16:44:54 · 132 阅读 · 0 评论 -
欧拉计划Problem 4
最大的回文数 回文数的读法是一样的。由两个两位数的乘积构成的最大回文数是 9009 = 91 × 99。 找出由两个 3 位数字的乘积构成的最大回文数。 方法一 #include<iostream> using namespace std; int func(int i){ int raw = i, t = 0; while(i){ //调转数字 t = t * 10 + i % 10; i = i / 10; } return t原创 2021-06-26 17:35:10 · 117 阅读 · 0 评论 -
空间复杂度&欧拉计划Problem2 偶斐波那契数列
Problem2 偶斐波那契数列 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, … By considering the terms in the Fibonacci sequence whose valu原创 2021-06-26 16:54:00 · 113 阅读 · 0 评论 -
时间复杂度&欧拉计划Problem1
如果我们列出所有 10 以下的自然数是 3 或 5 的倍数,我们会得到 3、5、6 和 9。这些倍数之和是 23。找出 1000 以下所有 3 或 5 的倍数之和。 方法一 #include<iostream> using namespace std; int main(){ int ans = 0; for(int i = 1; i < 1000; i++){ if(i % 3 == 0 || i % 5 == 0){ ans += i; } } cout <原创 2021-06-26 14:48:34 · 104 阅读 · 0 评论