跳到正文

题解

话不多数直接上代码

GuoziPro约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月1日
篇幅
约 1 分钟
获赞
1
题目
B2085

版本

  1. v1当前
话不多说直接上代码
#include <bits/stdc++.h>
using namespace std;

int main() {
	long long int n, ans, sum = 0;
	cin >> n;
	for (int i = 2;; i++) {
		ans = 0;
		for (int j = 2; j <= sqrt(i); j++) {
			if (i % j == 0)
				ans++;
		}
		if (ans == 0)
			sum++;
		if (sum == n) {
			cout << i;
			break;//这里用“return 0;”也可以。
		}
	}
	return 0;
}
原文