結果

問題 No.782 マイナス進数
ユーザー bluemeganebluemegane
提出日時 2021-05-08 11:08:24
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 652 bytes
コンパイル時間 3,146 ms
コンパイル使用メモリ 62,548 KB
実行使用メモリ 27,036 KB
最終ジャッジ日時 2023-10-14 14:29:53
合計ジャッジ時間 5,975 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
18,744 KB
testcase_01 AC 59 ms
22,692 KB
testcase_02 AC 94 ms
22,936 KB
testcase_03 AC 96 ms
25,020 KB
testcase_04 AC 100 ms
26,792 KB
testcase_05 AC 94 ms
24,832 KB
testcase_06 AC 92 ms
22,836 KB
testcase_07 AC 105 ms
26,972 KB
testcase_08 AC 95 ms
22,856 KB
testcase_09 AC 91 ms
22,832 KB
testcase_10 AC 92 ms
20,900 KB
testcase_11 AC 103 ms
24,868 KB
testcase_12 AC 101 ms
27,016 KB
testcase_13 AC 123 ms
26,892 KB
testcase_14 AC 101 ms
26,868 KB
testcase_15 AC 104 ms
26,944 KB
testcase_16 AC 101 ms
26,864 KB
testcase_17 AC 113 ms
27,036 KB
testcase_18 AC 102 ms
24,900 KB
testcase_19 AC 108 ms
22,688 KB
testcase_20 AC 103 ms
24,928 KB
testcase_21 AC 112 ms
25,052 KB
testcase_22 AC 102 ms
27,004 KB
testcase_23 AC 100 ms
26,912 KB
testcase_24 AC 124 ms
24,952 KB
testcase_25 AC 100 ms
22,760 KB
testcase_26 AC 106 ms
26,936 KB
testcase_27 AC 103 ms
27,004 KB
testcase_28 AC 100 ms
24,924 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 -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Collections.Generic;
using System;

public class hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var t = int.Parse(line[0]);
        var b = int.Parse(line[1]);
        while (t-- > 0)
        {
            var n = int.Parse(Console.ReadLine().Trim());
            var ans = new List<int>();
            while (n != 0)
            {
                var mod = n % b;
                n /= b;
                if (mod < 0) { n++; mod -= b; }
                ans.Add(mod);
            }
            ans.Reverse();
            Console.WriteLine(string.Join("", ans));
        }
    }
}
0