結果
問題 |
No.2385 Parse Integer with Radix
|
ユーザー |
|
提出日時 | 2023-07-22 15:06:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 305 bytes |
コンパイル時間 | 1,626 ms |
コンパイル使用メモリ | 175,272 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 14:50:46 |
合計ジャッジ時間 | 2,198 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int T; cin >> T; map<char, int> mp{{'b', 2}, {'o', 8}, {'x', 16}}; while(T--){ string s; cin >> s; cout << (s.size() < 2 || isdigit(s[1]) ? stoll(s) : stoll(s.substr(2), nullptr, mp[s[1]])) << '\n'; } }