20分求调
查看原帖
20分求调
1702309
wyz20041108楼主2025/8/4 17:42
#include<bits/stdc++.h>
using namespace std;
int l , cnt , num;
int main(){
      cin >> l;
      for(int i = 2;i <= l;i++){
            for(int j = 1;j <= sqrt(i);j++){
                   if(i % j == 0){
                         continue;
                   }
            }
            if(cnt+i <= l){
                  cout << i << endl;
                   num++;
            }else{
                  break;
            }
      }
      cout << num;
      return 0;
}

2025/8/4 17:42
加载中...