結果

問題 No.600 かい文回
コンテスト
ユーザー Kutimoti_T
提出日時 2018-06-06 17:25:48
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 928 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,223 ms
コンパイル使用メモリ 185,100 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-03-20 07:56:34
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); (i)++)
int main() {
  i64 N;
  cin >> N;
  i64 K = 0;
  string all = "qwertyuiopasdfghjklzxcvbnm";
  int idx = 0;
  string ans = "qwqw";
  if (N == 1) {
    cout << "a" << endl;
    return 0;
  }
  int i = 40;
  while (!(N & (1LL << i)))
    i--;
  i--;
  idx = 2;
  cout << "start : " << i + 1 << endl;
  bool first = true;
  for (; i >= 0; i--) {
    if (!first) {
      ans = ans[1] + ans;
      ans = ans[1] + ans;
      ans = ans + ans[0] + ans[1];
    }
    first = false;
    if (N & (1LL << i)) {
      cout << i << endl;
      ans = string() + all[idx] + all[idx + 1] + ans + all[idx] + all[idx + 1];
      idx += 2;
      if(idx + 1 >= all.size()){
        idx = 0;
        reverse(all.begin(),all.end());
        random_shuffle(all.begin(),all.end());
      }
    }
  }

  cout << ans << endl;
}
0