結果
| 問題 |
No.600 かい文回
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-24 23:30:52 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,370 bytes |
| コンパイル時間 | 2,314 ms |
| コンパイル使用メモリ | 197,184 KB |
| 最終ジャッジ日時 | 2025-01-05 04:21:28 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 15 WA * 6 |
ソースコード
#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]++;
}
}
if(ind.size() >= 1){
ind[0]++;
}
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;
}