会员
周边
众包
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
主函数
戒骄 戒躁 坚持 不懈
博客园
首页
新随笔
联系
订阅
管理
POJ 3006 Dirichlet's Theorem on Arithmetic Progressions
/**/
/*
*************************************
Problem: POJ 3006 Dirichlet's Theorem on Arithmetic Progressions
Time: 79MS
Memory: 1180K
Accepted Time: 2009-05-17 10:41:54
Tips:
*************************************
*/
#include
<
stdio.h
>
#include
<
string
.h
>
#define
MAX 1000000
int
main()
{
bool
num[MAX
+
1
];
memset(num,
true
,
sizeof
(num));
num[
1
]
=
false
;
int
i,j;
for
(i
=
2
;i
<=
MAX
/
2
;i
++
)
if
(num[i])
for
(j
=
2
;i
*
j
<=
MAX;j
++
)num[i
*
j]
=
false
;
int
a,d,n;
while
(
1
)
{
scanf(
"
%d%d%d
"
,
&
a,
&
d,
&
n);
if
(a
==
0
&&
d
==
0
&&
n
==
0
)
break
;
int
count
=
0
;
while
(count
!=
n)
{
if
(num[a])count
++
;
a
+=
d;
}
printf(
"
%d\n
"
,a
-
d);
}
return
0
;
}
posted @
2009-05-17 12:40
主函数
阅读(
280
) 评论(
0
)
收藏
举报
刷新页面
返回顶部
公告