結果

問題 No.164 ちっちゃくないよ!!
ユーザー やまぞうやまぞう
提出日時 2015-03-18 01:05:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 807 bytes
コンパイル時間 668 ms
コンパイル使用メモリ 75,512 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 15:23:07
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdint>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

int N;
vector<string> V;
vector<int64_t> VV;

void input(istream& in)
{
	in >> N;
	V.resize(N);
	for (int i = 0; i < N; i++) {
		in >> V[i];
	}
}

int64_t resolve()
{
	VV.reserve(N);
	for (string& s : V) {
		int base = 2;
		for (char ch : s) {
			if (ch > base) {
				base = ch;
			}
		}
		base = (base < 'A') ? (base - '0') : (base - 'A' + 10);
		base++;
		int64_t value = 0;
		for (char ch : s) {
			value *= base;
			value += (ch < 'A') ? (ch - '0') : (ch - 'A' + 10);
		}
		VV.push_back(value);
	}
	int64_t value = *min_element(VV.begin(), VV.end());
	return value;
}

int main()
{
	input(cin);
	cout << resolve() << endl;
	return 0;
}
0