結果

問題 No.3150 count X which satisfies with equlation
ユーザー Qvito
提出日時 2025-05-20 21:33:41
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 3,566 bytes
コンパイル時間 2,576 ms
コンパイル使用メモリ 274,096 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-20 02:59:06
合計ジャッジ時間 3,703 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
template <typename T, std::size_t N>
using vecar = vector<array<T, N>>;
template <typename T>
using uset = unordered_set<T>;
template <typename K, typename V>
using umap = unordered_map<K, V>;

constexpr char SPC[] = " ";
constexpr char NEL[] = "\n";
constexpr char TAB[] = "\t";
constexpr long double PI = std::numbers::pi_v<long double>;

namespace infinity{
	using ll = long long;
	using ld = long double;
	template <typename T>
	struct infinity; 
	template <>
	struct infinity<int> { static constexpr int inf = 1100000000; };
	template <>
	struct infinity<ll> { static constexpr long long inf = 1100000000000000000; };
	template <>
	struct infinity<double> { static constexpr double inf = std::numeric_limits<double>::infinity(); };
	template <>
	struct infinity<ld> { static constexpr long double inf = std::numeric_limits<ld>::infinity(); };
	template <typename T>
	constexpr T inf = infinity<T>::inf;
}
using namespace infinity;

#define nop while(false)
#define loop while(true)
#define _rep1(n) for(int _i = 0; _i < int(n); _i++)
#define _rep2(i, n) for(int i = 0; i < int(n); i++)
#define _rep3(i, a, n) for(int i = a; i < int(n); i++)
#define _rep4(i, a, n, b) for(int i = a; i < int(n); i += b)
#define _rep(a, b, c, d, num, ...) _rep##num
#define rep(...) _rep(__VA_ARGS__, 4, 3, 2, 1)(__VA_ARGS__)
#define repcond(a) 0 || (a)
#define elif else if
#define entry int main
#define fun auto

#define fs first
#define sc second
#define pb push_back
#define all(v) (v).begin(), (v).end() 

template <typename... Args>
void out(Args... args) {
	(std::cout << ... << args);
}
template <typename... Args>
void outbr(Args... args) {
	((std::cout << args << " "), ...);
	std::cout << "\n";
}
template <typename... Args>
void in(Args&... args) {
	(std::cin >> ... >> args);
}
#define intin(...) int __VA_ARGS__; in(__VA_ARGS__)
#define llin(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define NSin() int N; std::string S; in(N, S)
#define rarray(name, a, b) _RANGEARRAY_##name[(b) - (a)];\
		auto name = _RANGEARRAY_##name - (a)

#define E1  *10
#define E2  *100
#define E3  *1000
#define E4  *10000
#define E5  *100000
#define E6  *1000000
#define E7  *10000000
#define E8  *100000000
#define E9  *1000000000
#define E10 *10000000000
#define PT +10

#define outAry(A, N) {\
	out(#A, ": ");\
	for(int _j = 0; _j < N; _j++){\
		out(A[_j], " \n"[_j == N-1]);\
	}\
}nop

template <typename Itr>
void outrange(Itr begin, Itr end){
	if(begin == end)return;
	auto itr = begin;
	while(1){
		std::cout << *itr;
		itr++;
		if(itr != end){
			std::cout << " ";
		}
		else {
			std::cout << "\n";
			break;
		}
	}
}

struct pairhash {
	template <class T1, class T2>
	size_t operator() (const pair<T1, T2>& p) const {
		auto h1 = hash<T1>{}(p.first);
		auto h2 = hash<T2>{}(p.second);
		return h1 ^ (h2 << 1);
	}
};

template <typename T>
bool inRange(T c, T a, T b) {
	return (min(a, b) <= c && c < max(a, b));
}

#define deb if constexpr(DEBUG_MODE)
#define judicium(a){\
	if constexpr(UCASE == 0){\
		out(a ? "yes" : "no", NEL);\
	}\
	elif constexpr(UCASE == 1){\
		out(a ? "Yes" : "No", NEL);\
	}\
	else{\
		out(a ? "YES" : "NO", NEL);\
	}\
}nop
// UCASE: 0 => lower case
// UCASE: 1 => initial capital
// UCASE: 2 => upper case
constexpr int UCASE = 1;
constexpr int DEBUG_MODE = true;

entry() {
	/*
	intin(A, B);
	int X = ~(A & B);
	// popcount
	*/
	intin(A, B);
	int count = 0;
	rep(X, 256) {
		if((A | X) == B) {
			count++;
		}
	}
	outbr(count);
}
0