水一个代码:

#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. Node.js权威指南 (1) - Node.js介绍

    1.1 Node.js概述 / 2 1.1.1 使用Node.js能够解决什么问题 / 2 1.1.2 实现高性能服务器 / 2 1.1.3 非阻塞型I/O及事件环机制 / 2 1.1.4 Node. ...

  2. ARM 开发板嵌入式linux系统与主机PC通过串口传输文件

    本文转载自http://useless20.blog.163.com/blog/static/237409982010227127576/ 嵌入式linux系统与主机通过串口传输文件 我想如果要从PC ...

  3. UILabel的使用方法

    UILabel 就是一个显示文字的控件,可以设置文字的各种属性. 构造方法:     //通过设置Label的边框来初始化UILabel     labelOfSlider = [[UILabelal ...

  4. Matlab编程-数值计算相关语法

    1.变量的命名规则(类似C语言): (1)    区分大小写 (2)    变量长度不超过31位 (3)    变量名以字母开头,变量名中包含字母.数字.下划线,不可以用标点 2. Mathlab预定 ...

  5. Anjuta 调试无输出 warning: GDB: Failed to set controlling terminal

    调试无输出,起初以为是那个warning的问题,后来才知道这个系统printf直到遇到'\n'换行符才输出,VC6用习惯了没想到还有这样的,网上说这样是节省系统资源. 那个warning暂时还没看到影 ...

  6. poj 2449 第k短路

    题目链接:http://poj.org/problem?id=2449 #include<cstdio> #include<cstring> #include<iostr ...

  7. 2016 GDCPC 省赛总结

    大神们说,要多写博客,多总结,于是很久之前就开了博客,可是一篇文章都没有写,太懒也是,没什么时间也是.现在省赛结束了,也是时候好好总结一下了. 本来一开始,三个人对拿铜牌是很有把握的,在比赛一开始A了 ...

  8. Linux命令之hwclock - 查询和设置硬件时钟

    常用参数 -r, --show         读取并打印硬件时钟(read hardware clock and print result ) -s, --hctosys      将硬件时钟同步到 ...

  9. 个人收藏的flex特效网址【经典中的极品】

    http://www.noupe.com/adobe/flex-developers-toolbox-free-components-themes-and-tutorials.html经典中的经典 h ...

  10. 基于xmpp openfire smack开发之smack类库介绍和使用[2]

    http://blog.csdn.net/shimiso/article/details/8816540 关于Smack编程库,前面我们提到,它是面向Java端的api,主要在PC上使用,利用它我们可 ...