結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
![]() |
提出日時 | 2023-11-03 20:16:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,279 bytes |
コンパイル時間 | 2,211 ms |
コンパイル使用メモリ | 196,196 KB |
最終ジャッジ日時 | 2025-02-17 17:25:46 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> #include<iostream> #include<iomanip> #include<string> #include<algorithm> #include<vector> #include<set> #include<list> #include<queue> #include<math.h> #include<bitset> using ll = long long; using namespace std; int main(){ ll n; ll mans = numeric_limits<ll>::max(); cin >> n; vector<char> v(36); v = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9','A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; for (ll k = 0; k < n; k++){ ll base = 0, maxb = 0, pow = 1; ll ans = 0; string s; cin >> s; for (ll i = 0; i < s.size(); i++) { for (ll j = 0; j < 36; j++){ if (s[i] == v[j]) { maxb = max(maxb, j); break; } } } base = ++maxb; for (ll i = s.size()-1; i >= 0; i--) { for (ll j = 0; j < 36; j++){ if (s[i] == v[j]) { ans += j*pow; break; } } pow *= base; } mans = min(mans, ans); } cout << mans << endl; }