結果
| 問題 | No.164 ちっちゃくないよ!! |
| コンテスト | |
| ユーザー |
CELICA
|
| 提出日時 | 2020-10-01 21:10:50 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 747 bytes |
| コンパイル時間 | 1,467 ms |
| コンパイル使用メモリ | 173,232 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 03:58:39 |
| 合計ジャッジ時間 | 2,042 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 11 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ul = unsigned long;
using ull = unsigned long long;
template<class T> inline bool chmin(T& a, T b)
{
if (a > b)
a = b;
return a > b;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
ll res{ (ll)1e20 };
for (int i = 0; i < n; ++i)
{
string s;
cin >> s;
string sw(s);
sort(sw.rbegin(), sw.rend());
char m = sw[0];
char r = (m <= '9' ? '0' : 'A' - 10);
int mm = m - r + 1;
ll x = 1, sum{ 0 };
for (int d = (int)s.size() - 1; d >= 0; --d)
{
if (s[d] <= '9')
sum += (s[d] - '0') * x;
else
sum += (s[d] - 'A' + 10) * x;
x *= mm;
}
chmin(res, sum);
}
cout << res << "\n";
return 0;
}
CELICA