大神求调
查看原帖
大神求调
1621906
Emily1234楼主2025/7/21 18:10
#include<iostream>
using namespace std;

int main()
{
    int n;
    cin >>n;
    int a[n+5] = {};
    int r;
    for(int i = 1;i <= n;i++)
    {
        r = 0;
        cin >>a[i];
        int q =a[i];
        for(int j = 2;j <= a[i];j++)
        {
            for(int z = 2;z <=q;z++)
            {
                if(q %j == 0)
                {
                    if(j % z!=0 || j == z)
                    {

                        r++;
                    }
                    else
                    {
                        z =q;
                    }
                }
            }
            
        }
        if(r%2==0)
        {
            cout <<1<<endl;
        }
        else{
            cout <<0<<endl;
        }
    }
    
    
    
}

}

2025/7/21 18:10
加载中...