結果

問題 No.2087 基数の変換
ユーザー bluemegane
提出日時 2022-09-30 22:22:48
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 26 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 1,717 ms
コンパイル使用メモリ 103,424 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2024-12-23 00:06:34
合計ジャッジ時間 4,124 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 51
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var m = int.Parse(Console.ReadLine().Trim());
        getAns(m, n);
    }
    static void getAns(int n, int a)
    {
        var t = new List<int>();
        while (n >= a)
        {
            t.Add(n % a);
            n /= a;
        }
        t.Add(n);
        t.Reverse();
        Console.WriteLine(string.Join("", t));
    }
}
0