結果

問題 No.164 ちっちゃくないよ!!
ユーザー bluemeganebluemegane
提出日時 2018-10-02 14:36:14
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 870 ms
コンパイル使用メモリ 111,180 KB
実行使用メモリ 27,248 KB
最終ジャッジ日時 2024-04-20 14:29:06
合計ジャッジ時間 1,564 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
18,944 KB
testcase_01 AC 23 ms
18,688 KB
testcase_02 AC 24 ms
18,944 KB
testcase_03 AC 23 ms
18,944 KB
testcase_04 AC 23 ms
18,688 KB
testcase_05 AC 25 ms
18,944 KB
testcase_06 AC 25 ms
19,200 KB
testcase_07 AC 24 ms
19,200 KB
testcase_08 AC 25 ms
19,072 KB
testcase_09 AC 24 ms
19,200 KB
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var z = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        var d = new Dictionary<char, int>();
        for (int i = 0; i < 36; i++) d[z[i]] = i;
        var ans = new List<long>();
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            var a = getN(d, s);
            var a2 = getV(d, s, a);
            ans.Add(a2);
        }
        Console.WriteLine(ans.Min());
    }
    public static int getN (Dictionary<char,int> d,  string s)
    {
        var ans = 0;
        for (int i = 0; i < s.Length; i++)
            ans = Math.Max(ans, d[s[i]]);
        return ans + 1;
    }
    public static long getV (Dictionary<char,int> d , string s , int n)
    {
        var sL = s.Length;
        var ans = 0L;
        for (int i = 0; i < sL; i++)
            ans += (long)Math.Pow(n, sL - 1 - i) * d[s[i]];
        return ans;
    }
}
0