diff --git a/src/problem/mod.rs b/src/problem/mod.rs index 3a4f70b..d0103f6 100644 --- a/src/problem/mod.rs +++ b/src/problem/mod.rs @@ -36,4 +36,5 @@ mod p2808_minimum_seconds_to_equalize_a_circular_array; mod p2670_find_the_distinct_difference_array; mod lcp24_nums_game; mod p1686_stone_game_vi; -mod p1690_stone_game_vii; \ No newline at end of file +mod p1690_stone_game_vii; +mod p292_nim_game; \ No newline at end of file diff --git a/src/problem/p292_nim_game.rs b/src/problem/p292_nim_game.rs new file mode 100644 index 0000000..8d5af7d --- /dev/null +++ b/src/problem/p292_nim_game.rs @@ -0,0 +1,26 @@ +/** + * [292] Nim Game + */ +pub struct Solution {} + + +// submission codes start here + +impl Solution { + pub fn can_win_nim(n: i32) -> bool { + n % 4 != 0 + } +} + +// submission codes end + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_292() { + assert!(Solution::can_win_nim(5)); + assert!(!Solution::can_win_nim(4)); + } +}