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


  • 相关阅读:
    laravel数据库配置
    mysql中utf8和utf8mb4区别
    laravel中artisan的用法
    laravel项目composer安装
    Linux 文件描述符
    Centos 7/8 SELinux
    Centos 7/8 高级磁盘管理技术
    Centos 7/8 搭建NFS Server
    Centos 7/8 日志管理
    Centos 7/8 Chronyd时间同步
  • 原文地址:https://www.cnblogs.com/mofushaohua/p/7789481.html
Copyright © 2011-2022 走看看