結果

問題 No.701 ひとりしりとり
ユーザー tactac
提出日時 2019-07-26 12:38:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 1,394 bytes
コンパイル時間 1,608 ms
コンパイル使用メモリ 172,804 KB
実行使用メモリ 21,148 KB
最終ジャッジ日時 2023-09-15 00:18:52
合計ジャッジ時間 3,523 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
20,280 KB
testcase_01 AC 22 ms
20,332 KB
testcase_02 AC 22 ms
19,636 KB
testcase_03 AC 23 ms
19,504 KB
testcase_04 AC 23 ms
21,148 KB
testcase_05 AC 22 ms
19,952 KB
testcase_06 AC 23 ms
19,952 KB
testcase_07 AC 23 ms
20,084 KB
testcase_08 AC 22 ms
19,540 KB
testcase_09 AC 23 ms
19,536 KB
testcase_10 AC 34 ms
19,460 KB
testcase_11 AC 137 ms
19,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rep3(i, l, n) for (int i = l; i < n; ++i)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define out(a) cout << a << endl
#define outa(a, n) rep(_, n) cout << a[_] << " "; cout << endl
#define SZ(v) (int)v.size()
#define inf (int)(1e9+7)

int main() {
    vector<string> v;
    v.eb("a");
    v.eb("aa");
    rep(i, 26) { string tmp = "a"; tmp += (char)('a' + i); tmp += 'a'; v.eb(tmp); }
    rep(i, 26) rep(j, 26) {
        string tmp = "a";
        tmp += (char)('a' + i);
        tmp += (char)('a' + j);
        tmp += 'a';
        v.eb(tmp);
    }
    rep(i, 26) rep(j, 26) rep(k, 26) {
        string tmp = "a";
        tmp += (char)('a' + i);
        tmp += (char)('a' + j);
        tmp += (char)('a' + k);
        tmp += 'a';
        v.eb(tmp);
    }
    rep(i, 26) rep(j, 26) rep(k, 26) rep(l, 26) {
        string tmp = "a";
        tmp += (char)('a' + i);
        tmp += (char)('a' + j);
        tmp += (char)('a' + k);
        tmp += (char)('a' + l);
        tmp += 'a';
        v.eb(tmp);
    }
    //outa(v, SZ(v));
    //out(SZ(v));
    int n;
    cin >> n;
    rep(i, n - 1) {
        out(v[i]);
    }
    out("an");
}
0