From b256588a78161c71ddc44dc7852a41dee90b1218 Mon Sep 17 00:00:00 2001
From: jackfiled <xcrenchangjun@outlook.com>
Date: Sat, 30 Nov 2024 11:31:00 +0800
Subject: [PATCH] 20241130 finished.

---
 src/problem/mod.rs                            |  2 ++
 .../p3232_find_if_digit_game_can_be_won.rs    | 30 +++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 src/problem/p3232_find_if_digit_game_can_be_won.rs

diff --git a/src/problem/mod.rs b/src/problem/mod.rs
index ff935a0..f22cbc9 100644
--- a/src/problem/mod.rs
+++ b/src/problem/mod.rs
@@ -342,3 +342,5 @@ mod p3206_alternating_groups_i;
 mod p3208_alternating_groups_ii;
 
 mod p3250_find_the_count_of_monotonic_pairs_i;
+
+mod p3232_find_if_digit_game_can_be_won;
diff --git a/src/problem/p3232_find_if_digit_game_can_be_won.rs b/src/problem/p3232_find_if_digit_game_can_be_won.rs
new file mode 100644
index 0000000..4c652b3
--- /dev/null
+++ b/src/problem/p3232_find_if_digit_game_can_be_won.rs
@@ -0,0 +1,30 @@
+/**
+ * [3232] Find if Digit Game Can Be Won
+ */
+pub struct Solution {}
+
+// submission codes start here
+
+impl Solution {
+    pub fn can_alice_win(nums: Vec<i32>) -> bool {
+        nums.into_iter()
+            .map(|x| if x >= 10 { (0, x) } else { (x, 0) })
+            .fold([(0, 0)], |acc, e| [(acc[0].0 + e.0, acc[0].1 + e.1)])
+            .iter()
+            .all(|x| x.0 != x.1)
+    }
+}
+
+// submission codes end
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_3232() {
+        assert!(!Solution::can_alice_win(vec![1, 2, 3, 4, 10]));
+        assert!(Solution::can_alice_win(vec![1, 2, 3, 4, 5, 14]));
+        assert!(Solution::can_alice_win(vec![5, 5, 5, 25]));
+    }
+}