0幸运数字 - 蓝桥云课 (lanqiao.cn)
count = 0def add_sum(num):nums = []for i in num:nums.append(int(i))return sum(nums)for i in range(1, 999999):if count < 2023:bin_num = bin(i)[2:]oct_num = oct(i)[2:]hex_num = hex(i)[2:]tm = []for j in hex_num:tm.append(int(j, 16))if i % add_sum(bin_num) == 0 and i % add_sum(oct_num) == 0 and i % sum(tm) == 0 and i % add_sum(str(i)) == 0:count += 1else:print(i - 1)break
0缩位求和 - 蓝桥云课 (lanqiao.cn)
import os
import sys
# 请在此输入您的代码
def dfs(num):
s=str(num)
nums_l = list(map(int, list(s)))
if len(nums_l)==1:
return nums_l[0]
return dfs(sum(nums_l))
n=int(input())
print(dfs(n))
0ISBN号码 - 蓝桥云课 (lanqiao.cn)
import os
import sys
# 请在此输入您的代码
# n='0-670-82162-4'
# n='0-670-82162-4'
n=input()
# ['0', '-', '6', '7', '0', '-', '8', '2', '1', '6', '2', '-', '4']
res=0
num=1
for i in n[:-2]:
if not i =='-':
res+=int(i)*num
num+=1
id=res % 11
if id ==10:
id='X'
if n[-1]==str(id):
print("Right")
else:
print(n[:-1]+str(id))