求解,困惑中,为啥只有50分?今天弄不明白,会郁闷的睡不好啊
查看原帖
求解,困惑中,为啥只有50分?今天弄不明白,会郁闷的睡不好啊
675208
coder2009楼主2022/11/12 19:36

贴上我的代码,哪位能帮忙看看?先谢过了

#include <bits/stdc++.h>
using namespace std;

void best_coder() {
    int n;
    cin >> n;
    vector<char> c = {'a', 'b', 'c', 'd', 'e',
                      'f', 'g', 'h', 'i', 'j',
                      'k', 'l', 'm', 'n', 'o',
                      'p', 'q', 'r', 's', 't',
                      'u', 'v', 'w', 'x', 'y',
                      'z'};
    do {
        for (int i = 0; i < min(26, n); ++i) {
            cout << c[i];
        }
        n -= min(26, n);
    } while (next_permutation(c.begin(), c.end()) && n > 0);
}

void happy_coder() {
}

int main() {
    // 提升cin、cout效率
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    best_coder();

    // happy_coder();

    // 返回
    return 0;
}
2022/11/12 19:36
加载中...