Skip to content

Dịch các đề bài, phân tích chiến lược giải các bài projecteuler.net

Notifications You must be signed in to change notification settings

quangvinh1986/python-projecteuler-net

Repository files navigation

Project Euler là một loạt các bài toán liên quan đến ứng dụng toán học, tư duy logic và lập trình.

Trong nhiều trường hợp, bạn có thể tạo ra một giải pháp "trâu bò" để ra được kết quả.

Nếu bạn thực sự muốn tạo ra các giải pháp tốt, tối ưu về giải thuật và thời gian chạy nhanh chóng, bạn cần nghiên cứu một số giải thuật toán học đằng sau các vấn đề.

Việc tối ưu được một bài toán từ PE sẽ giúp người thực hiện có một "bước tiến" trong tư duy logic và ứng dụng ngôn ngữ lập trình.

Cá nhân tôi thích "toán học" (mặc dù không giỏi toán) và tôi lựa chọn Python để giải quyết các bài toán trên PE.

Hiện tại, tôi đã giải được https://projecteuler.net/profile/vinhnq.png bài toán trên Project euler. Nhưng do tôi ... hơi lười và nhiều bài toán tìm ra đáp án còn đơn giản hơn là diễn đạt ra được giải thích lý do tại sao lại làm như vậy. Chính vì vậy, tôi mới thực hiện giải được số lượng bài như bên dưới:

Số thứ tự Giải thích Kết quả chạy Code Python & giải thích Benchmark timings
Problem 001 Multiples of 3 and 5 233168 Code Python 1.00135803223e-05s
Problem 002 Even-Fibonacci-numbers 4613732 Code Python 1.31130218506e-05s
Problem 003 Largest-prime-factor 6857 Code Python 1.31130218506e-05s
Problem 004 Largest-palindrome-product 906609 Code Python 0.00604486465454s
Problem 005 Smallest-multiple 4613732 Code Python 4.100799560546875e-05s
Problem 006 Sum-square-difference 25164150 Code Python 3.981590270996094e-05s
Problem 007 10001st-prime 104743 Code Python 0.188479185104s
Problem 008 Largest-product-in-a-series 23514624000 Code Python 0.0036547183990478516s
Problem 009 Pythagorean-triplets 4613732 Code Python 0.02037191390991211s
Problem 010 Summation-of-primes 142913828922 Code Python 6.484667062759399s
Problem 011 Largest-product-in-a-grid 70600674 Code Python 0.002034902572631836s
Problem 012 Highly-divisible-triangular-number 76576500 Code Python 3.9072110652923584s
Problem 013 Large-sum 5537376230 Code Python 9.775161743164062e-06s
Problem 014 Longest-Collatz-sequence 837799 Code Python 1.7523188591003418s
Problem 016 Power-digit-sum 1366 Code Python 0.00020003318786621094s
Problem 018 Maximum-path-sum-I 1704 Code Python 8.821487426757812e-05s
Problem 010 Counting-Sundays 171 Code Python 0.0005667209625244141s
Problem 020 Sum-of-Digits-in-100gt 648 Code Python 0.000347137451171875s
Problem 021 Amicable-numbers 852810 Code Python 1.5143499374389648s
Problem 023 Non-abundant-sums 4179871 Code Python 4.60374903678894s
Problem 024 Lexicographic-permutations 2783915460 Code Python 2.47955322265625e-05s

P/S: Đến bài PE-023, thời gian chạy ra kết quả ở trên là thời gian thực hiện Code Python và run trên máy MacPro có cấu hình:

MacBook Pro (13-inch, 2016, Two Thunderbolt 3 ports)

Processor 2 GHz Intel Core i5

Memory 8 GB 1867 MHz LPDDR3

Note: Repo này tôi repush lại thay cho 1 tài khoản git mà tôi đã lỡ quên mật khẩu.

About

Dịch các đề bài, phân tích chiến lược giải các bài projecteuler.net

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages