# Project Euler
Problems are taken from https://projecteuler.net/, the Project Euler. [Problems are licensed under CC BY-NC-SA 4.0](https://projecteuler.net/copyright).
Project Euler is a series of challenging mathematical/computer programming problems that require more than just mathematical
insights to solve. Project Euler is ideal for mathematicians who are learning to code.
The solutions will be checked by our [automated testing on GitHub Actions](https://github.com/TheAlgorithms/Python/actions) with the help of [this script](https://github.com/TheAlgorithms/Python/blob/master/scripts/validate_solutions.py). The efficiency of your code is also checked. You can view the top 10 slowest solutions on GitHub Actions logs (under `slowest 10 durations`) and open a pull request to improve those solutions.
## Solution Guidelines
Welcome to [TheAlgorithms/Python](https://github.com/TheAlgorithms/Python)! Before reading the solution guidelines, make sure you read the whole [Contributing Guidelines](https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md) as it won't be repeated in here. If you have any doubt on the guidelines, please feel free to [state it clearly in an issue](https://github.com/TheAlgorithms/Python/issues/new) or ask the community in [Gitter](https://gitter.im/TheAlgorithms/community). You can use the [template](https://github.com/TheAlgorithms/Python/blob/master/project_euler/README.md#solution-template) we have provided below as your starting point but be sure to read the [Coding Style](https://github.com/TheAlgorithms/Python/blob/master/project_euler/README.md#coding-style) part first.
### Coding Style
* Please maintain consistency in project directory and solution file names. Keep the following points in mind:
* Create a new directory only for the problems which do not exist yet.
* If you create a new directory, please create an empty `__init__.py` file inside it as well.
* Please name the project **directory** as `problem_<problem_number>` where `problem_number` should be filled with 0s so as to occupy 3 digits. Example: `problem_001`, `problem_002`, `problem_067`, `problem_145`, and so on.
* Please provide a link to the problem and other references, if used, in the **module-level docstring**.
* All imports should come ***after*** the module-level docstring.
* You can have as many helper functions as you want but there should be one main function called `solution` which should satisfy the conditions as stated below:
* It should contain positional argument(s) whose default value is the question input. Example: Please take a look at [Problem 1](https://projecteuler.net/problem=1) where the question is to *Find the sum of all the multiples of 3 or 5 below 1000.* In this case the main solution function will be `solution(limit: int = 1000)`.
* When the `solution` function is called without any arguments like so: `solution()`, it should return the answer to the problem.
* Every function, which includes all the helper functions, if any, and the main solution function, should have `doctest` in the function docstring along with a brief statement mentioning what the function is about.
* There should not be a `doctest` for testing the answer as that is done by our GitHub Actions build using this [script](https://github.com/TheAlgorithms/Python/blob/master/scripts/validate_solutions.py). Keeping in mind the above example of [Problem 1](https://projecteuler.net/problem=1):
```python
def solution(limit: int = 1000):
"""
A brief statement mentioning what the function is about.
You can have a detailed explanation about the solution method in the
module-level docstring.
>>> solution(1)
...
>>> solution(16)
...
>>> solution(100)
...
"""
```
### Solution Template
You can use the below template as your starting point but please read the [Coding Style](https://github.com/TheAlgorithms/Python/blob/master/project_euler/README.md#coding-style) first to understand how the template works.
Please change the name of the helper functions accordingly, change the parameter names with a descriptive one, replace the content within `[square brackets]` (including the brackets) with the appropriate content.
```python
"""
Project Euler Problem [problem number]: [link to the original problem]
... [Entire problem statement] ...
... [Solution explanation - Optional] ...
References [Optional]:
- [Wikipedia link to the topic]
- [Stackoverflow link]
...
"""
import module1
import module2
...
def helper1(arg1: [type hint], arg2: [type hint], ...) -> [Return type hint]:
"""
A brief statement explaining what the function is about.
... A more elaborate description ... [Optional]
...
[Doctest]
...
"""
...
# calculations
...
return
# You can have multiple helper functions but the solution function should be
# after all the helper functions ...
def solution(arg1: [type hint], arg2: [type hint], ...) -> [Return type hint]:
"""
A brief statement mentioning what the function is about.
You can have a detailed explanation about the solution in the
module-level docstring.
...
[Doctest as mentioned above]
...
"""
...
# calculations
...
return answer
if __name__ == "__main__":
print(f"{solution() = }")
```
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
在过去的三个月中,Julia 在 RedMonk 的排名中上升了三位,排名第 36 位(来源:RedMonk) Julia 的崛起,与目前编程语言发展遭遇的瓶颈息息相关:随着人工智能尤其是机器学习的兴起,现实世界对计算的速度及性能要求也越来越高,不同的编程语言由于自身的局限性难以兼顾,例如说,在 Julia 诞生之前,很多人不得不把同样的程序进行多次处理:首先使用 Python 或 R 这样的语言来开发一种算法,并通过这些语言制作图表,然后再用 C++或 Java 改写程序,以获得更好的计算机处理性能。 突破这种瓶颈无疑有两个方向,一是基于现有编程语言进行优化,二是“将革命进行到底”——专门开发一门新语言。后者自然成本更高。 Julia 的开发人员显然选择了后者,而且他们的野心不小:Julia 被专门设计为用于快速运行基础数学,这正是大多数数据科学的基础,如矩阵表达式和线性代数。 它的诞生可追溯到 2009 年。当时,正是基于对现有编程语言的“不满”,麻省理工学院启动了一个新型编程语言开发计划,到了 2012 年的时候,这个计划有了初步的成果,也就是如今的 Ju
资源推荐
资源详情
资源评论
收起资源包目录
编程语言算法集 Python.rar (1293个子文件)
fetch_anime_and_play.py.BROKEN 5KB
CODEOWNERS 1KB
sample_data.csv 70KB
ex_data.csv 1KB
get_top_billionaires.py.disabled 2KB
.gitattributes 12B
.gitignore 1KB
pytest.ini 60B
example_wikipedia_image.jpg 476KB
output.jpg 116KB
PSNR-example-comp-10.jpg 104KB
lena.jpg 102KB
input.jpg 59KB
2D_problems.jpg 57KB
2D_problems_1.jpg 40KB
example_image.jpg 29KB
lena_small.jpg 7KB
project_euler_answers.json 63KB
loudness_curve.json 812B
settings.json 87B
DIRECTORY.md 58KB
CONTRIBUTING.md 11KB
binary_tree_traversals.md 5KB
README.md 5KB
README.md 4KB
local_weighted_learning.md 3KB
README.md 3KB
README.md 3KB
README.md 3KB
normal_distribution_quick_sort.md 2KB
README.md 1KB
pull_request_template.md 1KB
README.md 1KB
LICENSE.md 1KB
README.md 867B
README.md 747B
README.md 724B
README.md 722B
ABOUT.md 452B
README.md 441B
README.md 415B
README.md 374B
README.md 303B
README.md 295B
README.md 287B
README.md 264B
java历史进程.pdf 214KB
PSNR-example-base.png 4.31MB
original_image.png 82KB
gaussian.png 52KB
compressed_image.png 26KB
red_black_tree.py 25KB
graph_adjacency_matrix.py 22KB
graph_adjacency_list.py 21KB
sequential_minimum_optimization.py 20KB
area.py 19KB
index_calculation.py 19KB
linear_discriminant_analysis.py 17KB
volume.py 16KB
binary_search_tree_recursive.py 16KB
convex_hull.py 16KB
directed_and_undirected_(weighted)_graph.py 15KB
singly_linked_list.py 15KB
primelib.py 14KB
convolution_neural_network.py 14KB
lib.py 14KB
viterbi.py 14KB
sol1.py 14KB
double_ended_queue.py 13KB
k_means_clust.py 13KB
binomial_heap.py 12KB
skip_list.py 12KB
multi_level_feedback_queue.py 12KB
diffie_hellman.py 12KB
input_data.py 12KB
n_body_simulation.py 12KB
2_hidden_layers_neural_network.py 11KB
temperature_conversions.py 11KB
davisb_putnamb_logemannb_loveland.py 11KB
md5.py 11KB
matrix_class.py 11KB
tabu_search.py 11KB
simplex.py 11KB
weight_conversion.py 10KB
lru_cache.py 10KB
lfu_cache.py 10KB
avl_tree.py 9KB
hamming_code.py 9KB
decrypt_caesar_with_chi_squared.py 9KB
binary_search.py 9KB
minimum_spanning_tree_prims2.py 9KB
binary_tree_traversal.py 9KB
enigma_machine2.py 9KB
multi_heuristic_astar.py 8KB
dijkstra_bankers_algorithm.py 8KB
basic_graphs.py 8KB
bidirectional_a_star.py 8KB
sherman_morrison.py 8KB
lz77.py 8KB
caesar_cipher.py 8KB
共 1293 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
野生的大熊
- 粉丝: 230
- 资源: 247
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功