0分!求调!
查看原帖
0分!求调!
1076255
Zao20121001楼主2024/11/20 21:44
#include<bits/stdc++.h>
using namespace std;
int s[10010], ls;
int main()
{
	for(int i = 2;i <= 10000;i++)
	{
		bool f = 0;
		for(int j = 2;j <= sqrt(i);j++)
		{
			if(i % j == 0)
			{
				f = 1;
				break; 
			}
		}
		if(f == 0)
		{
			s[++ls] = i;
		}
	}
	int n;
	cin >> n;
	while(n--)
	{
		int ans = 0;
		ls = 1;
		int a;
		cin >> a;
		while(a != 1)
		{
			if(a % s[ls] == 0)
			{
				a /= s[ls];
			}
			else
			{
				ans++;
				ls++;
			}
		}
		ans++;
		if(ans == 2)
		{
			cout << 1 << endl;
		}
		else
		{
			cout << 0 << endl;
		}
	}
	return 0;
}
2024/11/20 21:44
加载中...