杭电2012
来源:互联网 发布:mac office 2016 破解 编辑:程序博客网 时间:2024/06/10 11:05
注意调用数学函数的时候要注意函数的参数所属的类型,如sqrt的参数必须是浮点型的,若为其它类型的就会出来编译错误
#include<iostream>
using namespace std;
int main()
{
int shu(int a);
int x=1,y=1,i,m,n;
while(cin>>x>>y&&(x!=0||y!=0))
{
n=0;
for(i=x;i<=y;i++)
{
m=i*i+i+41;
if(shu(m)!=0)
{
n++;
break;
}
}
if(n==0)
cout<<"OK"<<endl;
else
cout<<"Sorry"<<endl;
}
return 0;
}
int shu(int a)
{
int b,i,c=0;
for(i=2;i*i<=a;i++)
{
if(a%i==0)
{
c++;
break;
}
}
if(c==0)
return 0;
else return 1;
}
- 杭电2012
- 杭电2012
- 杭电2012
- 杭电2012
- 杭电 2012
- 杭电2012
- 杭电2012
- 杭电2012 C++
- 杭电2012
- 杭电2012
- 杭电2012
- 杭电 2012 素数判定
- 杭电2012素数判定
- 2012杭电 素数判定
- 杭电 2012 素数判定
- 【杭电】[2012]素数判定
- 【杭电2012】素数判定
- 【杭电】2012 素数判定
- 获取servlet的方法
- SAP企业移动平台SAP Mobile Platform(SMP) 2.3 新特性
- Debian安装KDE图形界面
- 构造函数和构造代码块
- NEFU 654 Magic Tree(DP)
- 杭电2012
- php中session及cookie常用操作
- iPhone常用控件、UIActionSheet、UIAlertView
- this
- 输出转换
- 杭电2013
- 关于AL32UTF8 导入 AL16UTF16 遇到的问题
- C语言线性非循环单链表
- LeetCode —— Decode Ways