UVA - 10110 Light, more light

//本来想用数组,结果RE,后来发现只是需要判定最后一个,并不需要数组
//可是,然后就,WA了...
/*WA
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
int n;

int main()
{
	while (cin >> n)
	{
		if (!n) break;
		int ans = 0;
		
		for (int i = 1; i <= n; i++)
		if (n % i == 0) ans = !ans;
		
		if (ans) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}*/


/*后来发现数据范围似乎不对,可是改为long long 以后,就TLE了...心痛!!!
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
ll n;

int main()
{
	while (cin >> n)
	{
		if (!n) break;
		int ans = 0;
		
		for (ll i = 1; i <= n; i++)
		if (n % i == 0) ans = !ans;
		
		if (ans) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}*/

/*
  最后才发觉,这题其实是数论题,不能用蛮劲,必须得巧做啊!
  以及很清楚的解析:
  http://blog.csdn.net/metaphysis/article/details/6535147
*/

#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
ll n;

int main()
{
	while (cin >> n)
	{
		if (!n) break;
		int ans = 0;
		
		ll t = sqrt(n);
		if (t * t == n) ans = 1;
		
		if (ans) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}


posted @ 2017-08-28 16:47  mofushaohua  阅读(146)  评论(0)    收藏  举报