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

小红的“质数”寻找

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 广东

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务