結果

問題 No.164 ちっちゃくないよ!!
ユーザー __math__math
提出日時 2015-03-12 23:32:18
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 1,204 bytes
コンパイル時間 1,427 ms
コンパイル使用メモリ 98,560 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 15:12:32
合計ジャッジ時間 2,292 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_DEPRECATE

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
#include <iterator>
#include <bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)(c).size())
#define ten(x) ((int)1e##x)
#define tenll(x) ((ll)1e##x)

int main(){
	int n; cin >> n;
	ull ans = ULLONG_MAX;
	FOR(i, n){
		string s; cin >> s;
		vector<int> v;
		int mx = 0;
		for (auto c : s) {
			int x;
			if ('0' <= c && c <= '9') x = c - '0';
			else x = c - 'A' + 10;
			v.push_back(x);
			mx = max(mx, x);
		}
		mx++;
		ull tmp = 0;
		for (auto b : v) {
			tmp = tmp * mx + b;
		}
		ans = min(ans, tmp);
	}

	cout << ans << endl;
}
0