题目描述
题目中等,注意输出格式即可。
样例
#include <iostream>
#include <algorithm>
using namespace std;
bool is_prime(int x)
{
if (x < 2) return false;
for (int i = 2; i <= x / i; i ++ )
if (x % i == 0)
return false;
return true;
}
int main()
{
int n;
cin >> n;
while (n -- )
{
int x;
cin >> x;
if (is_prime(x)) cout << x << " is prime\n";
else cout << x << " is not prime\n";
}
return 0;
}