1.小平方
代码
n = int(input())
count=0
def f(x)->bool: # 判断条件
return True if x**2%n<n/2 else False
for i in range(1,n): # 遍历[1,n-1],符合题意计数加一
if f(i):
count+=1
print(count)
2.3的倍数
代码
a = int(input())
b = int(input())
c = int(input())
if (a+b)%3==0 or (a+c)%3==0 or (b+c)%3==0:
print('yes')
else:
print('no')
3.格点
代码
count=0
for i in range(1,2022):
for j in range(1,2022):
if i*j<=2021:
count+=1
print(count)