結果

問題 No.1729 ~サンプルはちゃんと見て!~ 16進数と8進数(1)
ユーザー kabipoyokabipoyo
提出日時 2021-11-05 21:26:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,714 bytes
コンパイル時間 3,602 ms
コンパイル使用メモリ 226,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 05:13:57
合計ジャッジ時間 4,400 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef int64_t lint;
#define rep(i, n) for(int i=0; i<n; i++)
#define repx(i, l, n) for(int i=l; i<n; i++)
#define all(v) v.begin(), v.end()
#define show(x) cout << #x << ": " << x << endl;
#define list(x) cout << #x << ": " << x << "  ";
#define pb push_back
using vi = vector<lint>;
using vvi = vector<vector<lint>>;
template<class T> inline void vin(vector<T>& v) { rep(i, v.size()) cin >> v.at(i); }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline void drop(T x) { cout << x << endl; exit(0); }
template<class T> void vout(vector<T> v) { rep(i, v.size()) { cout << v.at(i) << ' '; } cout << endl; }
constexpr lint LINF = LLONG_MAX/2;

int main() {
	string N, S;
	cin >> N;
	vi v(8);

	lint a=0, b=0, c=0, x, y, z;
	if (N.size()%3 == 1) S += "00";
	if (N.size()%3 == 2) S += "0";
	rep(i, N.size()) {
		if (N[i] == 'A') S += "1010";
		if (N[i] == 'B') S += "1011";
		if (N[i] == 'C') S += "1100";
		if (N[i] == 'D') S += "1101";
		if (N[i] == 'E') S += "1110";
		if (N[i] == 'F') S += "1111";
	}
	rep(i, S.size()/3) {
		if (S.substr(i*3, 3) == "000") v[0]++;
		if (S.substr(i*3, 3) == "001") v[1]++;
		if (S.substr(i*3, 3) == "010") v[2]++;
		if (S.substr(i*3, 3) == "011") v[3]++;
		if (S.substr(i*3, 3) == "100") v[4]++;
		if (S.substr(i*3, 3) == "101") v[5]++;
		if (S.substr(i*3, 3) == "110") v[6]++;
		if (S.substr(i*3, 3) == "111") v[7]++;
	}
	rep(i, 8) chmax(a, v[i]);
	rep(i, 8) {
		if (v[i] == a) std::cout << i << ' ';
	}
	std::cout << '\n';
}
0