結果
問題 |
No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
|
ユーザー |
![]() |
提出日時 | 2024-01-19 00:48:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 906 bytes |
コンパイル時間 | 2,347 ms |
コンパイル使用メモリ | 197,132 KB |
最終ジャッジ日時 | 2025-02-18 20:26:50 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; inline string hex2oct(string hex) { int dec = stoi(hex, nullptr, 16); string oct = ""; while (dec > 0) { oct = to_string(dec % 8) + oct; dec /= 8; } return oct; } int main() { string s; cin >> s; vector<int> cnt(8, 0); string t = ""; for (char c : s) { if (t.size() == 3) { string u = hex2oct(t); for (char d : u) cnt[d - '0']++; t = ""; } t += c; } string u = hex2oct(t); for (char d : u) cnt[d - '0']++; t = ""; int maxim = 0; rep(i, 8) maxim = max(maxim, cnt[i]); Debug(maxim); rep(i, 8) { if (cnt[i] == maxim) cout << i << " "; } cout << endl; return 0; }