水一个代码:

#include <iostream>
using namespace std;
int n, a; bool ok;
bool prime (int x) {
for (int i = ; i * i <= x; i++) if (x % i == ) return false;
return true;
}
int main() {
cin >> n;
while (n--) {
cin >> a;
ok = false;
for (int i = ; i * i <= a; i++)
if (a % i == )
if (prime (a / i) ) {
ok = true;
break;
}
else break;
if (ok) cout << "Yes" << endl;
else cout << "No" << endl;
}
return ;
}
 

SGU 113.Nearly prime numbers的更多相关文章

  1. SGU 113

    113. Nearly prime numbers time limit per test: 0.25 sec. memory limit per test: 4096 KB Nearly prime ...

  2. 快速切题 sgu113 Nearly prime numbers 难度:0

    113. Nearly prime numbers time limit per test: 0.25 sec. memory limit per test: 4096 KB Nearly prime ...

  3. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  4. POJ 2739 Sum of Consecutive Prime Numbers(尺取法)

    题目链接: 传送门 Sum of Consecutive Prime Numbers Time Limit: 1000MS     Memory Limit: 65536K Description S ...

  5. algorithm@ Sieve of Eratosthenes (素数筛选算法) & Related Problem (Return two prime numbers )

    Sieve of Eratosthenes (素数筛选算法) Given a number n, print all primes smaller than or equal to n. It is ...

  6. HDOJ(HDU) 2138 How many prime numbers(素数-快速筛选没用上、)

    Problem Description Give you a lot of positive integers, just to find out how many prime numbers the ...

  7. Codeforces 385C Bear and Prime Numbers

    题目链接:Codeforces 385C Bear and Prime Numbers 这题告诉我仅仅有询问没有更新通常是不用线段树的.或者说还有比线段树更简单的方法. 用一个sum数组记录前n项和, ...

  8. POJ2739 Sum of Consecutive Prime Numbers(尺取法)

    POJ2739 Sum of Consecutive Prime Numbers 题目大意:给出一个整数,如果有一段连续的素数之和等于该数,即满足要求,求出这种连续的素数的个数 水题:艾氏筛法打表+尺 ...

  9. Alexandra and Prime Numbers(思维)

    Alexandra and Prime Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (J ...

随机推荐

  1. Server.Transfer方法,Server.Execute方法和Response.Redirect方法有什么异同

    (1)Server.Transfer方法: Server.Transfer("m2.aspx");//页面转向(服务器上执行). 服务器停止解析本页,保存此页转向前的数据后,再使页 ...

  2. -_-#【HTML】同一个标签页打开

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  3. Unity5 的新旧延迟渲染Deferred Lighting Rendering Path

    unity5 的render path ,比4的区别就是使用的新的deferred rendering,之前的4的deferred rendering(其实是light prepass)也被保留了下来 ...

  4. OpenStack Havana 部署在Ubuntu 12.04 Server 【OVS+GRE】(三)——计算节点的安装

    序:OpenStack Havana 部署在Ubuntu 12.04 Server [OVS+GRE] 计算节点: 1.准备结点 安装好ubuntu 12.04 Server 64bits后,进入ro ...

  5. 数据结构学习笔记——stack实现(数组篇)

    一 栈:是一种表,限制插入和删除只能在一个位置,也即是表的末端(也是栈的顶)进行. 基本操作:push 和 pop. 二 栈的数组实现: 运用数组来存储元素,和栈操作先关的是theArray(一个数组 ...

  6. ubuntu 100M 到 10M

    浅析ubuntu下如何修改网卡网速--将100M网卡改为10M网卡 公司的路由器可能比较陈旧,机器启动之后,默认网卡是100M的,但是登录QQ经常出现掉线现象,后来得知原来需要将100M网卡降频到10 ...

  7. hdoj 4786 Fibonacci Tree【并查集+最小生成树(kruskal算法)】

    Fibonacci Tree Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  8. zoj 2100 Seeding

    Seeding Time Limit: 2 Seconds      Memory Limit: 65536 KB It is spring time and farmers have to plan ...

  9. maven怎么引入自定义jar的详细图文教程

    1 首先找到你的maven的配置文件{你maven的路径}\conf\settings.xml,然后打开settings.xml,并修改你存放本地jar路径.如我想把我自己的jar放到C:\Users ...

  10. java 打包插件

    是时候闭环Java应用了 原创 2016-08-16 张开涛  你曾经因为部署/上线而痛苦吗?你曾经因为要去运维那改配置而烦恼吗?在我接触过的一些部署/上线方式中,曾碰到过以下一些问题: 1.程序代码 ...