created and first commit(3 solusions)
This commit is contained in:
26
solutions/0000.zero/euler_0.py
Normal file
26
solutions/0000.zero/euler_0.py
Normal file
@@ -0,0 +1,26 @@
|
||||
"""
|
||||
Project Euler Problem 0 :
|
||||
Find the sum of all the odd squares which do not exceed 764000.
|
||||
|
||||
这是注册问题。
|
||||
"""
|
||||
|
||||
UP_NUM = 764000
|
||||
|
||||
|
||||
def is_even(num: int) -> bool:
|
||||
"""Check if a number is even."""
|
||||
return num & 1 == 0
|
||||
|
||||
|
||||
def main():
|
||||
res: list[int] = []
|
||||
for i in range(UP_NUM):
|
||||
t = (i + 1) ** 2
|
||||
if not is_even(t):
|
||||
res.append(t)
|
||||
print(sum(res))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user