結果
問題 |
No.164 ちっちゃくないよ!!
|
ユーザー |
![]() |
提出日時 | 2023-11-03 19:24:09 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,208 bytes |
コンパイル時間 | 1,883 ms |
コンパイル使用メモリ | 196,112 KB |
最終ジャッジ日時 | 2025-02-17 17:24:51 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 WA * 3 |
ソースコード
#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(){ int n; ll mans = 1e18; 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 (int k = 0; k < n; k++){ int base = 0, maxb = 0; ll ans = 0; string s; cin >> s; for (int i = 0; i < s.size(); i++) { for (int j = 0; j < 36; j++){ if (s[i] == v[j]) maxb = max(maxb, j); } } 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(base, (s.size()-i-1)); break; } } } mans = min(mans, ans); } cout << mans << endl; }