Switch Game
像这种题一般的蛮力法是会超时的,只能通过打印一部分结果然后找规律再确定怎么写程序。
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int m;
while(cin>>m){
int temp = (int)sqrt(double(m));
temp *= temp;
if(temp == m){
cout<<1<<endl;
}else{
cout<<0<<endl;
}
}
system("pause");
}