标签:
1 5
1 0Consider the second test case: The initial condition : 0 0 0 0 0 … After the first operation : 1 1 1 1 1 … After the second operation : 1 0 1 0 1 … After the third operation : 1 0 0 0 1 … After the fourth operation : 1 0 0 1 1 … After the fifth operation : 1 0 0 1 0 … The later operations cannot change the condition of the fifth lamp any more. So the answer is 0.Hinthint
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
double x=sqrt(n*1.0);
cout<<(x==int(x))<<endl;
}
return 0;
}
#include <iostream>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
int sum=0;
for(int i=1; i<=n; i++)
{
if(n%i==0)
sum++;
}
cout<<sum%2<<endl;
}
return 0;
}
HDU 2053 Switch Game(开灯问题,唯一分解定理)
标签:
原文地址:http://blog.csdn.net/hurmishine/article/details/51347080