解题思路:
因为只有8种情况,直接switch输出不同的结果,没有运算过程,速度遥遥领先
注意事项:

参考代码:

#include<bits/stdc++.h>

using namespace std;

int main(){

    int n;

    cin>>n;

    switch (n)

    {

    case 1:

        cout<<2<<endl<<3<<endl<<5<<endl<<7<<endl;

        break;

   

    case 2:

        cout << "23" << endl;

        cout << "29" << endl;

        cout << "31" << endl;

        cout << "37" << endl;

        cout << "53" << endl;

        cout << "59" << endl;

        cout << "71" << endl;

        cout << "73" << endl;

        cout << "79" << endl;

        break;

    case 3:

        cout << "233" << endl;

        cout << "239" << endl;

        cout << "293" << endl;

        cout << "311" << endl;

        cout << "313" << endl;

        cout << "317" << endl;

        cout << "373" << endl;

        cout << "379" << endl;

        cout << "593" << endl;

        cout << "599" << endl;

        cout << "719" << endl;

        cout << "733" << endl;

        cout << "739" << endl;

        cout << "797" << endl;

        break;

    case 4:

        cout << "2333" << endl;

        cout << "2339" << endl;

        cout << "2393" << endl;

        cout << "2399" << endl;

        cout << "2939" << endl;

        cout << "3119" << endl;

        cout << "3137" << endl;

        cout << "3733" << endl;

        cout << "3739" << endl;

        cout << "3793" << endl;

        cout << "3797" << endl;

        cout << "5939" << endl;

        cout << "7193" << endl;

        cout << "7331" << endl;

        cout << "7333" << endl;

        cout << "7393" << endl;

        break;

    case 5:

        cout << "23333" << endl;

        cout << "23339" << endl;

        cout << "23399" << endl;

        cout << "23993" << endl;

        cout << "29399" << endl;

        cout << "31193" << endl;

        cout << "31379" << endl;

        cout << "37337" << endl;

        cout << "37339" << endl;

        cout << "37397" << endl;

        cout << "59393" << endl;

        cout << "59399" << endl;

        cout << "71933" << endl;

        cout << "73331" << endl;

        cout << "73939" << endl;

        break;

    case 6:

        cout << "233993" << endl;

        cout << "239933" << endl;

        cout << "293999" << endl;

        cout << "373379" << endl;

        cout << "373393" << endl;

        cout << "593933" << endl;

        cout << "593993" << endl;

        cout << "719333" << endl;

        cout << "739391" << endl;

        cout << "739393" << endl;

        cout << "739397" << endl;

        cout << "739399" << endl;

        break;

    case 7:

        cout << "2339933" << endl;

        cout << "2399333" << endl;

        cout << "2939999" << endl;

        cout << "3733799" << endl;

        cout << "5939333" << endl;

        cout << "7393913" << endl;

        cout << "7393931" << endl;

        cout << "7393933" << endl;

        break;

    case 8:

        cout << "23399339" << endl;

        cout << "29399999" << endl;

        cout << "37337999" << endl;

        cout << "59393339" << endl;

        cout << "73939133" << endl;

        break;

    }

}


点赞(0)
 

0.0分

0 人评分

C语言网提供由在职研发工程师或ACM蓝桥杯竞赛优秀选手录制的视频教程,并配有习题和答疑,点击了解:

一点编程也不会写的:零基础C语言学练课程

解决困扰你多年的C语言疑难杂症特性的C语言进阶课程

从零到写出一个爬虫的Python编程课程

只会语法写不出代码?手把手带你写100个编程真题的编程百练课程

信息学奥赛或C++选手的 必学C++课程

蓝桥杯ACM、信息学奥赛的必学课程:算法竞赛课入门课程

手把手讲解近五年真题的蓝桥杯辅导课程

评论列表 共有 0 条评论

暂无评论