P5723 all TLE
  • 板块灌水区
  • 楼主luogu_tanbozhi
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/6/2 21:46
  • 上次更新2024/6/3 13:37:49
查看原帖
P5723 all TLE
1321076
luogu_tanbozhi楼主2024/6/2 21:46

TLE code:

#include<bits/stdc++.h>
using namespace std;

bool isPrime(int n) {
    if (n <= 1) {
        return false;
    }
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0) {
            return false;
        }
    }
    return true;
}

int main()
{
	cin.tie(0)->sync_with_stdio(false);
	int s, e;
	cin>>s>>e;
	for(int i=s; i<=e; i++){
		if (isPrime(i)){
			cout<<i<<endl;
		}
	}
	return 0;
}

help

2024/6/2 21:46
加载中...