結果

問題 No.600 かい文回
ユーザー nebukuro09nebukuro09
提出日時 2018-06-12 15:35:04
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 803 bytes
コンパイル時間 998 ms
コンパイル使用メモリ 101,320 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-03 20:23:46
合計ジャッジ時間 2,212 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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) {
        if (c >= 'x') c = 'a';
        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