USACO-1.5.3 Superprime Rib 特殊的质数肋骨

题目链接:http://acm.sdibt.edu.cn/JudgeOnline/problem.php?id=2319


代码如下:


#include


int d[9][18] = { { 0 },
    { 2,3,5,7,0 },
    { 23,29,31,37,53,59,71,73,79,0 },
    { 233,239,293,311,313,317,373,379,593,599,719,733,739,797,0 },
    { 2333,2339,2393,2399,2939,3119,3137,3733,3739,3793,3797,5939,7193,7331,7333,7393,0 },
    { 23333,23339,23399,23993,29399,31193,31379,37337,37339,37397,59393,59399,71933,73331,73939,0 },
    { 233993,239933,293999,373379,373393,593933,593993,719333,739391,739393,739397,739399,0 },
    { 2339933,2399333,2939999,3733799,5939333,7393913,7393931,7393933,0 },
    { 23399339,29399999,37337999,59393339,73939133,0 }
};


int main(){
    int n;
    while( scanf( "%d", &n ) != EOF ){
        int i = 0;
        while( d[n][i] ){
            printf( "%d\n", d[n][i] );
            i ++;
        }
    }
    return 0;
}

你可能感兴趣的:(ACM)