結果

問題 No.164 ちっちゃくないよ!!
ユーザー bluemeganebluemegane
提出日時 2020-09-11 20:00:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 61 ms / 2,000 ms
コード長 1,087 bytes
コンパイル時間 996 ms
コンパイル使用メモリ 63,840 KB
実行使用メモリ 22,836 KB
最終ジャッジ日時 2023-08-27 05:30:38
合計ジャッジ時間 2,496 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,716 KB
testcase_01 AC 59 ms
20,712 KB
testcase_02 AC 59 ms
20,716 KB
testcase_03 AC 60 ms
20,808 KB
testcase_04 AC 59 ms
20,676 KB
testcase_05 AC 61 ms
22,788 KB
testcase_06 AC 61 ms
22,836 KB
testcase_07 AC 60 ms
20,800 KB
testcase_08 AC 61 ms
20,736 KB
testcase_09 AC 60 ms
18,700 KB
testcase_10 AC 59 ms
20,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Hello
{
    public static Dictionary<char, int> d;
    static void Main()
    {
        var s = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        d = new Dictionary<char, int>();
        for (int i = 0; i < 36; i++) d[s[i]] = i;
        var n = int.Parse(Console.ReadLine().Trim());
        var amin = long.MaxValue;
        for (int i = 0; i < n; i++)
        {
            var a = Console.ReadLine().Trim();
            var   maxc =  getMaxc(a);
            amin = Min(amin, calc(a, maxc + 1));
        }
        Console.WriteLine(amin);

    }
    static long calc (string s , int n)
    {
        var s2 = s.ToCharArray();
        Array.Reverse(s2);
        var res = 0L;
        var sL = s.Length;
        var ex = 1L;
        for (int i = 0; i < sL; i++)
        {
            res += ex * d[s2[i]];
            ex *= n;
        }
        return res;
    }
    static int getMaxc(string s)
    {
        var res = 0;
        foreach (var x in s) res = Max(res, d[x]);
        return res;
    }
}
0