c++20分求助
查看原帖
c++20分求助
1070491
Kmeow楼主2024/2/27 20:56
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long l,sum=2,cnt=0;
	cin>>l;
	for(int i=1;i<=l;i++)
	{
		for(int j=1;j<=i;j++)
		{
			if(i%j!=0)
			{
				if(sum<l)
				{
					sum+=i;
					cout<<i<<endl;
					cnt++;	
				}
			}
		}
	}
	cout<<cnt;
}

测评界面(无语)

恳请大佬及神犇犇们指正,本人感激不尽

2024/2/27 20:56
加载中...