摘要:
http://ac.jobdu.com/problem.php?cid=1040&pid=49题目描述:给定一个数n,要求判断其是否为素数(0,1,负数都是非素数)。输入:测试数据有多组,每组输入一个数n。输出:对于每组输入,若是素数则输出yes,否则输入no。样例输入:13// 题目50:素数判定.cpp: 主项目文件。 #include "stdafx.h"
#include #include bool isPrime(int n)
{ if(n<=1) return false; int tt=(int)sqrt(1.0*n); for(int i=2; 阅读全文
posted @ 2013-03-06 11:30
cjweffort
阅读(261)
评论(0)
推荐(0)