結果
| 問題 | No.164 ちっちゃくないよ!! |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2020-09-11 20:00:22 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 33 ms / 2,000 ms |
| コード長 | 1,087 bytes |
| コンパイル時間 | 2,476 ms |
| コンパイル使用メモリ | 104,832 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-12-26 14:52:17 |
| 合計ジャッジ時間 | 3,605 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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;
}
}
bluemegane