結果
問題 | No.600 かい文回 |
ユーザー |
|
提出日時 | 2018-06-12 15:35:04 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 803 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 115,856 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-13 01:12:56 |
合計ジャッジ時間 | 1,536 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
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; }