Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
71555 | 胡海峰老师 | 二进制数问题 | Python3 | Accepted | 38 MS | 3740 KB | 340 | 2024-04-25 20:06:13 |
def judge_AB(n): #integer 整数 ones,zeros = 0,0 while n: #非0为True 0为False b = n%2 if b==1: ones +=1 else: zeros +=1 n = n//2 return ones>zeros #True:A类 False: B类 a =0 for num in range(1,1001): a += judge_AB(num) print(a,1000-a)