zoukankan      html  css  js  c++  java
  • UVA

    //本来想用数组,结果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;
    }


  • 相关阅读:
    B/S架构
    RPC远程过程调用详解
    Ubuntu18.04安装MongoDB
    Python2.X SQLAlchemy @@tx_isolation警告
    Excel单元格内自动换行自动行高,打印预览出现内容缺失解决方案
    Winform应用的多语言设置
    单例模式创建窗口
    相似命名的字符串高效拼接
    利用dynamic动态创建对象
    设置全局快捷键
  • 原文地址:https://www.cnblogs.com/mofushaohua/p/7789481.html
Copyright © 2011-2022 走看看