Run ID:85282

提交时间:2024-07-16 21:09:10

#include <iostream> // 函数用于找到第N个美丽数 int findNthBeautifulNumber(int n) { int count = 0; int number = 1; while (true) { if (number % 3 == 0 || number % 5 == 0) { count++; if (count == n) { return number; } } number++; } } int main() { int n; while (std::cin >> n) { // 循环读取输入直到输入结束 std::cout << findNthBeautifulNumber(n) << std::endl; } return 0; }