From 8d3d54b5be760b8e95409dc921859147b9475b62 Mon Sep 17 00:00:00 2001 From: 1Kill2Steal <171241044+1Git2Clone@users.noreply.github.com> Date: Sat, 23 Nov 2024 18:58:51 +0200 Subject: [PATCH] Added I/O samples with explanations --- src/hw2/task_1.rs | 31 +++++++++++++++++++++++++++++++ src/hw2/task_2.rs | 19 +++++++++++++++++++ src/hw2/task_3.rs | 20 ++++++++++++++++++++ 3 files changed, 70 insertions(+) diff --git a/src/hw2/task_1.rs b/src/hw2/task_1.rs index 19cc670..244f230 100644 --- a/src/hw2/task_1.rs +++ b/src/hw2/task_1.rs @@ -20,6 +20,37 @@ const MAX: u32 = 2000; /// /// The count of all the positive numbers up to (and including) `n` which are divisible by `n`. /// +/// ### Sample +/// +/// #### Input Format +/// +/// ```txt +/// 200 +/// ``` +/// +/// #### Output Format +/// +/// ```txt +/// 12 +/// ``` +/// +/// #### Explanation +/// +/// The count of the numbers, divisble by n is 12 and they are: +/// +/// 1 - 1 +/// 2 - 2 +/// 3 - 4 +/// 4 - 5 +/// 5 - 8 +/// 6 - 10 +/// 7 - 20 +/// 8 - 25 +/// 9 - 40 +/// 10 - 50 +/// 11 - 100 +/// 12 - 200 +/// /// ### Error /// /// If the input is invalid, return: diff --git a/src/hw2/task_2.rs b/src/hw2/task_2.rs index 6e2f8b0..4a05652 100644 --- a/src/hw2/task_2.rs +++ b/src/hw2/task_2.rs @@ -21,6 +21,25 @@ const MAX: u32 = 2000; /// The sum of all the positive numbers up to (and including) `n` which are divisible by `n` and /// also prime numbers. /// +/// ### Sample +/// +/// #### Input Format +/// +/// ```txt +/// 200 +/// ``` +/// +/// #### Output Format +/// +/// ```txt +/// 7 +/// ``` +/// +/// #### Explanation +/// +/// 200 = 2^3 * 5^2 +/// 2 + 5 = 7 +/// /// ### Error /// /// If the input is invalid, return: diff --git a/src/hw2/task_3.rs b/src/hw2/task_3.rs index dc35d31..b65c120 100644 --- a/src/hw2/task_3.rs +++ b/src/hw2/task_3.rs @@ -21,6 +21,26 @@ const MAX: u32 = 2000; /// The sum of all the positive numbers up to (but **excluding**) `n` which are divisible by `n` /// and are NOT prime numbers. /// +/// ### Sample +/// +/// #### Input Format +/// +/// ```txt +/// 12 +/// ``` +/// +/// #### Output Format +/// +/// ```txt +/// 10 +/// ``` +/// +/// #### Explanation +/// +/// The divisors of 12 are 2, 3, 4, and 6 +/// +/// The sum of the divisors that are not prime is: 4 + 6 = 10. +/// /// ### Error /// /// If the input is invalid, return: