Skip to content

Commit

Permalink
update md
Browse files Browse the repository at this point in the history
  • Loading branch information
nt-sivan committed May 22, 2024
1 parent 1a27734 commit 62a53ee
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
7 changes: 7 additions & 0 deletions find-the-maximum-achievable-number/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions find-the-maximum-achievable-number/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "find-the-maximum-achievable-number"
version = "0.1.0"
edition = "2021"

[dependencies]
5 changes: 5 additions & 0 deletions find-the-maximum-achievable-number/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod solution;
use crate::solution::Solution;
fn main() {
println!("Hello, world!:{}", Solution::the_maximum_achievable_x(4, 1));
}
26 changes: 26 additions & 0 deletions find-the-maximum-achievable-number/src/solution.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pub struct Solution;

impl Solution {
pub fn the_maximum_achievable_x(num: i32, t: i32) -> i32 {
let mut number = num;
for i in 0..t {
number +=1;
}
number+t
}
}


#[cfg(test)]
mod tests {
use super::*;
#[test]
pub fn test_one() {
assert_eq!(6, Solution::the_maximum_achievable_x(4, 1));
}

#[test]
pub fn test_two() {
assert_eq!(7, Solution::the_maximum_achievable_x(3, 2));
}
}
1 change: 1 addition & 0 deletions find-the-maximum-achievable-number/title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024-05-22 找到最大可及的数字

0 comments on commit 62a53ee

Please sign in to comment.