結果
問題 |
No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
|
ユーザー |
|
提出日時 | 2022-06-04 20:51:00 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 811 bytes |
コンパイル時間 | 1,999 ms |
コンパイル使用メモリ | 196,784 KB |
最終ジャッジ日時 | 2025-01-29 18:12:38 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 7 |
ソースコード
#include <bits/stdc++.h> #define rep(i, n) for (int i = 0; i < n; ++i) typedef long long ll; using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(false); string S; cin >> S; vector<int> bin; for (char &c : S) { int d = c - 'A' + 10; while (d) { bin.push_back(d % 2); d /= 2; } } if (bin.size() % 3 != 0) { int n = 3 - bin.size() % 3; rep(i, n) bin.push_back(0); } vector<int> cnt(8); for (int i = 0; i < bin.size(); i += 3) { int cur = bin[i] + 2 * bin[i + 1] + 4 * bin[i + 2]; cnt[cur]++; } int ma = 0; rep(i, 8) ma = max(ma, cnt[i]); rep(i, 8) { if (cnt[i] == ma) cout << i << " "; } cout << "\n"; return 0; }