PersonalCorpus 版 (精华区)

1217371 Big Guava ... 10394 Accepted
0:03.280 20688 2002/11/05 12:54:21.007

void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\0acm\\uva\\contest11-2\\iB","r",stdin);
    freopen("c:\\0acm\\uva\\contest11-2\\oB","w",stdout);
#endif

    int i,j,k,t;
    char *p;
    int r[200010];

    p=(char *)malloc(20000000);
    memset(p,1,20000000);
    for (i=3;i<20000000;i+=2) if (p[i]) {
        k=i+i;
        for (j=i+k;j<20000000;j+=k) p[j]=0;
    }
    k=0;
    for (i=3;i<19999998;i+=2)
    if (p[i]&&p[i+2]) r[k++]=i;

    while (scanf("%d\n",&i)==1) {
        printf("(%d, %d)\n",r[i-1],r[i-1]+2);
    }

    free(p);

}
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.442毫秒