Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
85282 彭士宝 美丽数 C++ Time Limit Exceeded 1000 MS 272 KB 533 2024-07-16 21:09:10

Tests(0/1):


Code:

#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; }