diff --git a/algorithm-exercises-csharp/src/hackerrank/projecteuler/Euler001.cs b/algorithm-exercises-csharp/src/hackerrank/projecteuler/Euler001.cs index 553a822..e22f194 100644 --- a/algorithm-exercises-csharp/src/hackerrank/projecteuler/Euler001.cs +++ b/algorithm-exercises-csharp/src/hackerrank/projecteuler/Euler001.cs @@ -1,3 +1,5 @@ +// @link Problem definition [[docs/hackerrank/projecteuler/euler001.md]] + namespace algorithm_exercises_csharp.hackerrank.prohecteuler; using System.Diagnostics.CodeAnalysis; diff --git a/docs/.gitkeep b/docs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/docs/hackerrank/projecteuler/euler001.md b/docs/hackerrank/projecteuler/euler001.md new file mode 100644 index 0000000..d467a05 --- /dev/null +++ b/docs/hackerrank/projecteuler/euler001.md @@ -0,0 +1,49 @@ +# [Multiples of 3 and 5](https://www.hackerrank.com/contests/projecteuler/challenges/euler001) + +- Difficulty: #easy +- Category: #ProjectEuler+ + +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 $ N $. + +## Input Format + +First line contains $ T $ that denotes the number of test cases. +This is followed by $ T $ lines, each containing an integer, $ N $. + +## Constraints + +- 1 $ \leq T \leq 10^5 $ +- 1 $ \leq N \leq 10^9 $ + +## Output Format + +For each test case, print an integer that denotes the sum of all the multiples +of $ 3 $ or $ 5 $ below $ N $. + +## Sample Input 0 + +```text +2 +10 +100 +``` + +## Sample Output 0 + +```text +23 +2318 +``` + +## Explanation 0 + +For $ N = 10 $, 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 $. + +Similarly for $ N = 100 $, we get $ 2318 $.