結果
問題 | No.2385 Parse Integer with Radix |
ユーザー |
![]() |
提出日時 | 2023-07-21 23:08:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,213 bytes |
コンパイル時間 | 3,858 ms |
コンパイル使用メモリ | 252,600 KB |
最終ジャッジ日時 | 2025-02-15 17:31:10 |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
#include <bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using ll = long long;using ull = unsigned long long;using ld = long double;using pii = pair<int, int>;using pll = pair<long long, long long>;using mint = modint998244353;// using mint = modint1000000007;// 定数int INF = 1'000'000'007;long long INFL = 2e18;static const long double PI = acos(-1);// 小数の出力桁数指定__attribute__((constructor)) static void io_setup() noexcept {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);std::cout << std::fixed << std::setprecision(10);std::cerr << std::fixed << std::setprecision(10);}// rep Macro#define rep(i, n) for (int i = 0; i < (int)(n); i++)#define reps(i, s, n) for (int i = (s); i < (int)(n); i++)int main() {int Q;cin >> Q;string S;rep(qqq, Q) {cin >> S;ll ans;if (S.length() >= 2 and S[1] == 'b') {ans = stoll(S.substr(2), 0, 2);} else if (S.length() >= 2 and S[1] == 'o') {ans = stoll(S.substr(2), 0, 8);} else if (S.length() >= 2 and S[1] == 'x') {ans = stoll(S.substr(2), 0, 16);} else {ans = stoll(S);}cout << ans << endl;}}