aboutsummaryrefslogtreecommitdiff
path: root/alice_bob_flower_game.c
diff options
context:
space:
mode:
authorJack Sangdahl <[email protected]>2025-08-28 21:59:16 -0600
committerJack Sangdahl <[email protected]>2025-08-28 21:59:16 -0600
commite8c2d0bdc53d995966742df427a3ddd021ee3644 (patch)
tree653aff2b4fdd5e5637c97baf349fe9cf4af87417 /alice_bob_flower_game.c
parentbdc516f6293f9eabb3fb24ff3c7e2084034b4381 (diff)
downloadleetcode-e8c2d0bdc53d995966742df427a3ddd021ee3644.tar.gz
leetcode-e8c2d0bdc53d995966742df427a3ddd021ee3644.zip
3021. alice and bob playing flower game
Diffstat (limited to 'alice_bob_flower_game.c')
-rw-r--r--alice_bob_flower_game.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/alice_bob_flower_game.c b/alice_bob_flower_game.c
new file mode 100644
index 0000000..efe9866
--- /dev/null
+++ b/alice_bob_flower_game.c
@@ -0,0 +1,17 @@
+// 3021. Alice and Bob Playing Flower Game
+#include "leetcode.h"
+
+/*
+ * alice and bob are playing a turn-based game on a field with two lanes of
+ * flowers bet=een them. there are 'x' flowers in the first lane between alice
+ * and bob, and 'y' flowers in the second lane between them. return the number
+ * of possible pairs '(x, y)' that satisyf the conditions mentioned in the
+ * statement.
+ */
+
+long long flowerGame(int n, int m) { return 1LL * n * m / 2; }
+
+int main() {
+ printf("%lld\n", flowerGame(3, 2)); // expect: 3
+ printf("%lld\n", flowerGame(1, 1)); // expect: 0
+}