結果
問題 | No.782 マイナス進数 |
ユーザー | 👑 hos.lyric |
提出日時 | 2019-01-11 21:37:27 |
言語 | D (dmd 2.106.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,544 bytes |
コンパイル時間 | 8,651 ms |
コンパイル使用メモリ | 660,360 KB |
実行使用メモリ | 5,212 KB |
最終ジャッジ日時 | 2023-09-03 21:57:30 |
合計ジャッジ時間 | 14,437 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,328 KB |
testcase_01 | AC | 2 ms
4,332 KB |
testcase_02 | AC | 68 ms
5,080 KB |
testcase_03 | AC | 85 ms
5,192 KB |
testcase_04 | AC | 99 ms
5,212 KB |
testcase_05 | AC | 75 ms
5,156 KB |
testcase_06 | AC | 69 ms
5,112 KB |
testcase_07 | AC | 142 ms
5,168 KB |
testcase_08 | AC | 82 ms
5,120 KB |
testcase_09 | AC | 68 ms
5,152 KB |
testcase_10 | AC | 68 ms
5,132 KB |
testcase_11 | AC | 137 ms
5,136 KB |
testcase_12 | AC | 121 ms
5,056 KB |
testcase_13 | AC | 281 ms
5,084 KB |
testcase_14 | AC | 121 ms
5,112 KB |
testcase_15 | AC | 138 ms
5,144 KB |
testcase_16 | AC | 121 ms
5,192 KB |
testcase_17 | AC | 203 ms
5,144 KB |
testcase_18 | AC | 121 ms
5,136 KB |
testcase_19 | AC | 171 ms
5,136 KB |
testcase_20 | AC | 121 ms
5,144 KB |
testcase_21 | AC | 187 ms
5,112 KB |
testcase_22 | AC | 133 ms
5,200 KB |
testcase_23 | AC | 105 ms
5,156 KB |
testcase_24 | AC | 276 ms
5,140 KB |
testcase_25 | AC | 119 ms
5,156 KB |
testcase_26 | AC | 155 ms
5,156 KB |
testcase_27 | AC | 138 ms
5,116 KB |
testcase_28 | AC | 115 ms
5,132 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
ソースコード
import std.conv, std.stdio, std.string; import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex, std.typecons; import core.bitop; class EOFException : Throwable { this() { super("EOF"); } } string[] tokens; string readToken() { for (; tokens.empty; ) { if (stdin.eof) throw new EOFException; tokens = readln.split; } auto token = tokens[0]; tokens.popFront; return token; } int readInt() { return readToken().to!int; } long readLong() { return readToken().to!long; } real readReal() { return readToken().to!real; } void chmin(T)(ref T t, in T f) { if (t > f) t = f; } void chmax(T)(ref T t, in T f) { if (t < f) t = f; } int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = cast(int)(as.length); for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; } int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a < val)); } int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) => (a <= val)); } int T; long B; long[] N; void main() { try { for (; ; ) { T = readInt(); B = readLong(); N = new long[T]; foreach (t; 0 .. T) { N[t] = readLong(); } foreach (t; 0 .. T) { long[] a; for (long n = N[t]; n != 0; ) { auto r = (n % -B + -B) % -B; a ~= r; n = (n - r) / B; } writeln(a.reverse.to!string.replaceAll(regex(`[\[\], ]`), "")); } } } catch (EOFException e) { } }