結果

問題 No.164 ちっちゃくないよ!!
ユーザー しらゆきしらゆき
提出日時 2016-01-14 10:29:14
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 2,488 bytes
コンパイル時間 2,845 ms
コンパイル使用メモリ 116,520 KB
実行使用メモリ 22,712 KB
最終ジャッジ日時 2024-04-22 14:21:30
合計ジャッジ時間 2,095 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
19,072 KB
testcase_01 AC 26 ms
18,688 KB
testcase_02 AC 25 ms
18,560 KB
testcase_03 AC 26 ms
18,816 KB
testcase_04 AC 26 ms
18,816 KB
testcase_05 AC 31 ms
19,584 KB
testcase_06 AC 31 ms
19,200 KB
testcase_07 AC 28 ms
19,200 KB
testcase_08 AC 28 ms
18,944 KB
testcase_09 AC 29 ms
19,456 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;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static void Main()
    {
        int n = ri();
        var v = new string[n];

        long ans = long.MaxValue;

        for (int i = 0; i < n; i++)
        {
            v[i] = rs();
            var memo = new long[v[i].Length];
            for (int j = 0; j < v[i].Length; j++)
                memo[j] = num(v[i][j]);
            long m = 0;
            for(int j = 0; j < memo.Length; j++)
            {
                m += (long)Math.Pow(memo.Max() + 1, memo.Length - j - 1) * num(v[i][j]);
            }
            ans = Math.Min(ans, m);
        }

        Console.WriteLine(ans);
    }

    static int num(char a)
    {
        if (char.IsDigit(a)) return a - 48;
        else return a - 55;
    }

    #region Scan
    static int ri() { return int.Parse(Console.ReadLine().Trim()); }
    static long rl() { return long.Parse(Console.ReadLine().Trim()); }
    static double rd() { return double.Parse(Console.ReadLine().Trim()); }
    static string rs() { return Console.ReadLine().Trim(); }
    static int[] ria() { return Console.ReadLine().Trim().Split().Select(int.Parse).ToArray(); }
    static long[] rla() { return Console.ReadLine().Trim().Split().Select(long.Parse).ToArray(); }
    static double[] rda() { return Console.ReadLine().Trim().Split().Select(double.Parse).ToArray(); }
    static string[] rsa() { return Console.ReadLine().Trim().Split(); }
    static void mul(out int a, out int b) { var arr = ria(); a = arr[0]; b = arr[1]; }
    static void mul(out int a, out int b, out int c) { var arr = ria(); a = arr[0]; b = arr[1]; c = arr[2]; }
    static void mul(out int a, out int b, out int c, out int d) { var arr = ria(); a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
    static void mul(out long a, out long b) { var arr = rla(); a = arr[0]; b = arr[1]; }
    static void mul(out long a, out long b, out long c) { var arr = rla(); a = arr[0]; b = arr[1]; c = arr[2]; }
    static void mul(out long a, out long b, out long c, out long d) { var arr = rla(); a = arr[0]; b = arr[1]; c = arr[2]; d = arr[3]; }
    #endregion
    #region Math
    const int mod = 1000000007;
    static bool isprime(long n){ if (n < 2) return false; for (long i = 2; i * i <= n; i++) if (n % i == 0) return false; return true; }
    static long gcd(long a, long b) { return a == 0 ? b : gcd(b % a, a); }
    static long lcm(long a, long b) { return a * b / gcd(a, b); }
    #endregion
}
0