結果
問題 |
No.782 マイナス進数
|
ユーザー |
![]() |
提出日時 | 2021-05-08 11:08:24 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 652 bytes |
コンパイル時間 | 3,741 ms |
コンパイル使用メモリ | 112,228 KB |
実行使用メモリ | 32,520 KB |
最終ジャッジ日時 | 2024-09-16 09:06:13 |
合計ジャッジ時間 | 4,560 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 27 WA * 9 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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)); } } }