結果

問題 No.499 7進数変換
ユーザー bluemegane
提出日時 2018-09-14 07:45:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 1,000 ms
コード長 463 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 112,576 KB
実行使用メモリ 26,196 KB
最終ジャッジ日時 2024-07-01 04:36:21
合計ジャッジ時間 2,604 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Collections.Generic;
using System;

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