結果
問題 | No.164 ちっちゃくないよ!! |
ユーザー |
👑 |
提出日時 | 2019-05-06 10:21:46 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,012 bytes |
コンパイル時間 | 894 ms |
コンパイル使用メモリ | 73,452 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 04:47:58 |
合計ジャッジ時間 | 1,292 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 |
ソースコード
#include <cstdio> #include <cstdlib> #include <cstddef> #include <vector> #include <algorithm> #include <cmath> #include <cstring> #include <string> #include <iostream> #include <iomanip> #include <numeric> #define L64 long long int main(void) { int n; char a[100]; std::cin >> n; L64 minval = -1; for(int i = 0; i < n; i++){ std::cin >> a; int len = (int)strlen(a); int digmax = 0; for (int j = 0; j < len; j++){ int digval = 0; if(65 <= a[j]) { digval = a[j] - 55; } else { digval = a[j] - 48; } digmax = std::max(digmax, digval); } digmax++; L64 retval = 0; L64 mult = 1; for(int j = len - 1; 0 <= j; j--){ L64 digval = 0; if(65 <= a[j]) { digval = a[j] - 55; } else { digval = a[j] - 48; } retval += mult * digval; mult *= (L64)digmax; } if(i == 0) {minval = retval;} else{minval = std::min(minval, retval);} } std::cout << minval << std::endl; }