結果
| 問題 | No.164 ちっちゃくないよ!! |
| コンテスト | |
| ユーザー |
bluemegane
|
| 提出日時 | 2018-10-02 14:36:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,063 bytes |
| 記録 | |
| コンパイル時間 | 849 ms |
| コンパイル使用メモリ | 113,260 KB |
| 実行使用メモリ | 27,064 KB |
| 最終ジャッジ日時 | 2024-10-12 10:02:22 |
| 合計ジャッジ時間 | 1,854 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 1 |
コンパイルメッセージ
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 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;
}
}
bluemegane