题解 | 小红的“质数”寻找

小红的“质数”寻找

https://www.nowcoder.com/practice/0b98a50ea30e4a3a9fe08a46eeb5f7fc

#include <iostream>
#include <vector>
using namespace std;

vector<string> ans = {"2", "3", "5", "5", "7", "7", "12", "12", "12"};

void solve() {
    string str;
    cin >> str;
    int l = str.length();
    int j = str[0] - '0' - 1;
    string s(l - 1, '0');
    cout << ans[j] + s << endl;
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        solve();
    }

    return 0;
}
// 64 位输出请用 printf("%lld")

全部评论
这是啥
点赞 回复 分享
发布于 03-13 17:03 广东

相关推荐

求offer的大角牛:不吃香菜
点赞 评论 收藏
分享
牛客773130651号:巨佬,简历模板换成上下的,左右的很烦,hr看着不爽。。。科大随便乱杀,建议能保研就保研,不行也得考一下 ,985硕去干算法,比开发强多了。开发许多双非都能搞,学历优势用不上,算法有门槛
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务