笔记
#include <iostream>
using namespace std;
int main()
{
int n; cin >> n;
while (n --)
{
int x, flag = 0; cin >> x;
for (int i = 2; i * i <= x; i ++)
// 这里要注意 完全平方数 需要 <= 不然会漏掉
{
if (x % i == 0)
{
flag = 1;
break;
}
}
if (flag == 1) cout << x << " is not prime" << endl;
else cout << x << " is prime" << endl;
}
}