結果
問題 |
No.3150 count X which satisfies with equlation
|
ユーザー |
|
提出日時 | 2025-05-20 21:57:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,935 bytes |
コンパイル時間 | 1,653 ms |
コンパイル使用メモリ | 197,124 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-06-20 03:00:13 |
合計ジャッジ時間 | 2,768 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 42 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define mod99 998244353 #define endl "\n" #define rep(i,n) for (ll i = 0; i < (ll)(n); ++i) #define prep(i,a,n) for (ll i = a; i < n; ++i) #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(), a.rend() #define si(x) ((ll)(x).size()) #define YN(bool) if(bool){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;} #define yn(bool) if(bool){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} #define PRE(x) cout << fixed << setprecision(x) #define Yes cout << "Yes\n" #define No cout << "No\n" #define YES cout << "YES\n" #define NO cout << "NO\n" template <typename T> inline T gcd(T a,T b) {return (b==0)?a:gcd(b,a%b);} template <typename T> inline T lcm(T a, T b) {return a/gcd(a,b)*b;} template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } #define sq(x) ((x)*(x)) #define cube(x) ((x)*(x)*(x)) const ld PI=3.141592653589793238462643383279; const ld EPS=0.00000001; const ll INF=1000000000000000000LL; //string ABC = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; //string abc = "abcdefghijklmnopqrstuvwxyz"; bool issub(string s,string t){ ll i=0; for(char c:t){ if(i<si(s)&&s[i]==c) i++; } return i==si(s); } bool isprime(ll N){ if(N<2) return false; for(ll i=2; i*i<=N; i++) if(N%i==0) return false; return true; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll a, b;cin >> a >> b; vector<ll> p, q; while(a!=0) {p.push_back(a%2); a/=2;} while(b!=0) {q.push_back(b%2); b/=2;} ll n=si(p), m=si(q); if(n>m) rep(i,n-m) q.push_back(0); if(n<m) rep(i,m-n) p.push_back(0); reverse(all(p));reverse(all(q)); ll memo = 0; rep(i,si(p)) { if(p[i]==1&&q[i]==0) {cout << "0" << endl; return 0;} if(p[i]==1&&q[i]==1) memo++; } ll ans = 1; rep(i,memo) ans*=2; cout << ans << endl; }