結果
| 問題 |
No.164 ちっちゃくないよ!!
|
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-03-14 12:56:35 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,048 bytes |
| コンパイル時間 | 518 ms |
| コンパイル使用メモリ | 60,820 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 13:30:15 |
| 合計ジャッジ時間 | 1,093 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define RREP(i,s,e) for (i = e-1; i >= s; i--)
#define rrep(i,n) RREP(i,0,n)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 1e8
typedef long long ll;
ll power(ll a, int n) {
if (n == 0)
return 1;
else
return a * power(a,n-1);
}
int main() {
int i, j, n;
ll ans;
cin >> n;
ans = power(36,12);
rep (i,n) {
int base, w;
ll x, v;
string s;
cin >> s;
w = s.size();
base = 0;
for (char c : s) {
if (isdigit(c))
base = max(base,c - '0');
else
base = max(base,c - 'A' + 10);
}
base++;
v = 0;
rep (j,w){
if (isdigit(s[w-j-1]))
x = s[w-j-1] - '0';
else
x = s[w-j-1] - 'A' + 10;
v += power(base,j)*x;
}
ans = min(ans,v);
}
cout << ans << endl;
return 0;
}
h_noson