結果
問題 | No.782 マイナス進数 |
ユーザー | tenten |
提出日時 | 2020-09-01 09:08:50 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 322 ms / 2,000 ms |
コード長 | 771 bytes |
コンパイル時間 | 2,279 ms |
コンパイル使用メモリ | 74,444 KB |
実行使用メモリ | 48,344 KB |
最終ジャッジ日時 | 2024-04-28 22:18:48 |
合計ジャッジ時間 | 14,087 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 133 ms
40,868 KB |
testcase_01 | AC | 131 ms
40,992 KB |
testcase_02 | AC | 288 ms
47,204 KB |
testcase_03 | AC | 286 ms
47,172 KB |
testcase_04 | AC | 297 ms
47,000 KB |
testcase_05 | AC | 282 ms
47,104 KB |
testcase_06 | AC | 286 ms
47,004 KB |
testcase_07 | AC | 300 ms
47,552 KB |
testcase_08 | AC | 282 ms
47,252 KB |
testcase_09 | AC | 283 ms
47,212 KB |
testcase_10 | AC | 277 ms
47,240 KB |
testcase_11 | AC | 311 ms
47,132 KB |
testcase_12 | AC | 299 ms
47,288 KB |
testcase_13 | AC | 318 ms
48,276 KB |
testcase_14 | AC | 311 ms
47,148 KB |
testcase_15 | AC | 311 ms
47,228 KB |
testcase_16 | AC | 310 ms
47,004 KB |
testcase_17 | AC | 322 ms
47,128 KB |
testcase_18 | AC | 311 ms
47,160 KB |
testcase_19 | AC | 318 ms
47,120 KB |
testcase_20 | AC | 304 ms
47,312 KB |
testcase_21 | AC | 322 ms
47,152 KB |
testcase_22 | AC | 318 ms
47,240 KB |
testcase_23 | AC | 308 ms
47,180 KB |
testcase_24 | AC | 320 ms
48,344 KB |
testcase_25 | AC | 309 ms
47,228 KB |
testcase_26 | AC | 310 ms
47,208 KB |
testcase_27 | AC | 310 ms
47,368 KB |
testcase_28 | AC | 306 ms
46,788 KB |
testcase_29 | AC | 135 ms
41,324 KB |
testcase_30 | AC | 138 ms
41,004 KB |
testcase_31 | AC | 142 ms
41,324 KB |
testcase_32 | AC | 144 ms
41,596 KB |
testcase_33 | AC | 137 ms
41,508 KB |
testcase_34 | AC | 141 ms
41,104 KB |
testcase_35 | AC | 141 ms
41,164 KB |
testcase_36 | AC | 139 ms
41,352 KB |
testcase_37 | AC | 140 ms
41,344 KB |
ソースコード
import java.util.*; public class Main { static long[] dp; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); int b = -sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < t; i++) { StringBuilder tmp = new StringBuilder(); int n = sc.nextInt(); for (int j = 0; n > 0; j++) { int mod = n % b; n /= b; if (j % 2 == 1 && mod != 0) { n++; mod = b - mod; } tmp.append(mod); } if (tmp.length() == 0) { tmp.append("0"); } sb.append(tmp.reverse()).append("\n"); } System.out.print(sb); } }