Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
114663 | 汤奕硕 | 美丽数 | Python3 | Accepted | 840 MS | 4360 KB | 519 | 2025-03-22 21:06:12 |
import sys def find_nth_beautiful_number(n): def count(x): return x // 3 + x // 5 - x // 15 low = 1 high = 5 * n # 初始高值设为5倍的n,足够大以确保覆盖 ans = 0 while low <= high: mid = (low + high) // 2 cnt = count(mid) if cnt >= n: ans = mid high = mid - 1 else: low = mid + 1 return ans for line in sys.stdin: n = int(line.strip()) print(find_nth_beautiful_number(n))