您的位置:首页 > 其它

【练习01】 简单题(1)1012

2013-03-13 16:51 183 查看

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");
}


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: