###求助!!!
查看原帖
###求助!!!
619381
lingHUA123楼主2022/1/19 22:12
#include<iostream>
using namespace std;


int main() {
	int L; int a = 0; int ans = 0;
	cin >> L;
	
		for (int i = 2; ; i++)
		{
			a += i;
			for (int j = 2; j * j <= i; j++)
			{
				if (i % j != 0)
				{
					cout << i << endl;
					ans++;
				}
			}
			if (a > L)
			{
				break;
			}
		}
		cout << ans << endl;

	
	








	system("pause");
	return 0;
}
2022/1/19 22:12
加载中...