27 lines
462 B
Python
27 lines
462 B
Python
"""
|
|
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()
|