結果

問題 No.600 かい文回
ユーザー nebukuro09
提出日時 2018-06-12 15:33:48
言語 D
(dmd 2.109.1)
結果
WA  
実行時間 -
コード長 772 bytes
コンパイル時間 928 ms
コンパイル使用メモリ 113,920 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-13 01:12:50
合計ジャッジ時間 2,083 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

const long MOD = 10^^9 + 7;
const long BASE = 97;


void main() {
    auto N = readln.chomp.to!int;
    int[] B;
    for (int i = 0, M = N; M > 0; i+=1, M/=2) if (M % 2) B ~= i;
    int s = 0;
    string ans = "";
    char c = 'a';

    foreach (i; 0..B.length) {
        B[i] -= s;
        if (i + 1 == B.length) {
            foreach (_; 0..B[i]) ans ~= c;
        } else {
            foreach (_; 0..B[i]+1) ans ~= c;
            s += B[i];
            c += 1;
        }
    }

    auto sna = ans.dup;
    sna.reverse();
    ans = ans.to!string ~ "xyz" ~ sna.to!string;
    ans.writeln;
}
0