結果

問題 No.600 かい文回
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-11-25 04:25:06
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,678 bytes
コンパイル時間 1,692 ms
コンパイル使用メモリ 167,828 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 06:01:08
合計ジャッジ時間 3,186 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/
string to_binary(int N) {
    string s = "";
    int ok = 0;
    rrep(i, 30, 0) {
        int m = 1 << i;
        if (N < m) { if(ok)s += "0"; 
        }
        else s += "1", N -= m, ok = 1;
    }
    return s;
}



//---------------------------------------------------------------------------------------------------
void _main() {
    int N; cin >> N;
    string n = to_binary(N);
    //cout << n << endl;
    
    string ans = "a";
    char c = 'a';
    rep(i, 0, n.size()) {
        if (i) {
            char b = n[i];
            if (b == '1') {
                c++;
                if ('z' < c) c = 'a';
                ans = c + ans + c;
            }
        }
        if (i != n.size() - 1) ans = c + ans + c;
    }
    cout << ans << endl;
}
0