Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
116105 柯轶炜 美丽数 Python3 Accepted 1611 MS 4356 KB 379 2025-04-06 13:08:26

Tests(1/1):


Code:

import sys def count(x): return x // 3 + x // 5 - x // 15 for line in sys.stdin: N = int(line.strip()) low = 1 high = 1 while count(high) < N: high *= 2 # 二分查找 while low < high: mid = (low + high) // 2 if count(mid) >= N: high = mid else: low = mid + 1 print(low)