結果

問題 No.600 かい文回
ユーザー PachicobuePachicobue
提出日時 2017-11-24 23:28:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,337 bytes
コンパイル時間 1,846 ms
コンパイル使用メモリ 204,076 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-05 11:38:28
合計ジャッジ時間 4,628 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
6,944 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 1 ms
6,944 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 2 ms
6,940 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "sz=" << v.size() << "\n[";
    for (const auto& p : v) {
        os << p << ",";
    }
    os << "]\n";
    return os;
}

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = 1e9 + 7;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<int> ind;
    for (int i = 0; i < 64; i++) {
        if (N & (1LL << i)) {
            ind.push_back(i);
        }
    }
    for (int i = ind.size() - 1; i >= 1; i--) {
        ind[i] -= ind[i - 1];
        if (i != ind.size() - 1) {
            ind[i]++;
        }
    }
    show(ind);
    string st;
    for (int i = 0; i < ind.size(); i++) {
        const int cnt = ind[i];
        for (int j = 0; j < cnt; j++) {
            st.push_back('a' + i);
        }
    }
    cout << st << (char)('a' + ind.size());
    reverse(st.begin(), st.end());
    cout << st << endl;

    return 0;
}
0