#include <iostream>
using namespace std;
int main()
{
bool break_flag = false;
int i, x;
START:
while(cin >> x){
if(x%2==0 || x%3==0) {
cout << "非質數" << endl;
continue;
}
for(i=3; i*i<x; i+=2){
if(x%i==0) {
cout << "非質數" << endl;
goto START;
}
}
cout << "質數" << endl; }
return 0;
}
請問是否仍有地方需改善??
這種方式仍一直在 TLE 狀態..