結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
27,764 KB
testcase_01 AC 34 ms
25,904 KB
testcase_02 AC 34 ms
25,516 KB
testcase_03 AC 34 ms
27,776 KB
testcase_04 AC 34 ms
25,700 KB
testcase_05 AC 39 ms
25,652 KB
testcase_06 AC 39 ms
25,572 KB
testcase_07 AC 37 ms
25,368 KB
testcase_08 AC 37 ms
25,704 KB
testcase_09 AC 37 ms
23,604 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.Numerics;
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<BigInteger>();
        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 BigInteger getV (Dictionary<char,int> d , string s , int n)
    {
        var sL = s.Length;
        BigInteger ans = 0;
        for (int i = 0; i < sL; i++)
            ans += (BigInteger)Math.Pow(n, sL - 1 - i) * d[s[i]];
        return ans;
    }
}
0