aboutsummaryrefslogtreecommitdiffstats
path: root/1716/main.py
diff options
context:
space:
mode:
authorterminaldweller <devi@terminaldweller.com>2023-12-06 01:53:15 +0000
committerterminaldweller <devi@terminaldweller.com>2023-12-06 01:53:15 +0000
commitcad2d4f89181062f73d134b3bffb5cf943a2c43f (patch)
tree4ce8a2e6d8f0a6c6f9fd661edd293bd5f6a1bcdb /1716/main.py
parent1688 (diff)
downloadleetcode-cad2d4f89181062f73d134b3bffb5cf943a2c43f.tar.gz
leetcode-cad2d4f89181062f73d134b3bffb5cf943a2c43f.zip
1716
Diffstat (limited to '1716/main.py')
-rwxr-xr-x1716/main.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/1716/main.py b/1716/main.py
new file mode 100755
index 0000000..c919243
--- /dev/null
+++ b/1716/main.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+
+class Solution:
+ def totalMoney(self, n:int)->int:
+ week = n // 7
+ day = n % 7
+ total = 0
+ for i in range(week):
+ total += 28 + 7 * i
+ for i in range(day):
+ total += week + i + 1
+ return total
+
+def main():
+ solution = Solution()
+ print(solution.totalMoney(4))
+ print(solution.totalMoney(10))
+ print(solution.totalMoney(20))
+
+if __name__ == '__main__':
+ main()