Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <queue>
- #include <algorithm>
- #include <string>
- #include <stack>
- #include <set>
- #include <map>
- #define pii pair <int,int>
- #define vec vector
- using namespace std;
- using ll = long long;
- using ld = long double;
- using db = double;
- void cv(vector <int> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvl(vector <ll> &v){
- for (auto x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvv(vector <vector <int> > &v){
- for (auto x: v) cv(x);
- cout<<"\n";
- }
- void cvb(vector <bool> v){
- for (bool x: v) cout<<x<<' ';
- cout<<"\n";
- }
- void cvs(vector <string> v){
- for (auto a: v){
- cout<<a<<"\n";
- }
- }
- void cvp(vector <pii> a){
- for (auto p: a){
- cout<<p.first<<' '<<p.second<<"\n";
- }
- cout<<"\n";
- }
- int from(vector <int> v, int bs){
- int r=0;
- for (int i=0;i<v.size();++i){
- r += pow(bs,i) * v[i];
- }
- return r;
- }
- vector <int> to(int x, int bs){
- vector <int> v;
- while (x > 0){
- v.push_back(x % bs);
- x /= bs;
- }
- return v;
- }
- bool sh=0;
- bool ok(vector <int> v){
- int n = v.size();
- for (int i = 0; i < n; ++i){
- int cnt=0;
- if (v[i] == 1){
- i--;
- while (i+1 < n && v[i + 1] == 1){
- i++;
- cnt++;
- }
- }
- if (cnt >= 6){
- return 1;
- }
- }
- return 0;
- }
- int main()
- {
- ios::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- int ans=0;
- for (int x = 1; x < 16; ++x){
- for (int y = 0; y <= x; ++y){
- for (int z = 0; z <= y; ++z){
- bool can=1;
- vector <int> v = {z,y,x};
- if (sh){
- cout<<"x y z = "<<x<<' '<<y<<' '<<z<<"\n";
- }
- do {
- vector <int> conv = to(v[0]*16*16 + v[1] * 16 + v[2], 2);
- if (sh){
- cout<<"v\n";
- cv(v);
- cout<<"conv\n";
- cv(conv);
- }
- if (!ok(conv)){
- if (sh){
- cout<<"BAD\n";
- }
- can=0;
- break;
- }
- } while (next_permutation(v.begin(), v.end()));
- if (can) {
- if (sh) cout<<"GOOD\n";
- ans++;
- cv(v);
- vector <int> conv = to(v[2]*16*16 + v[1] * 16 + v[0], 2);
- cv(conv);
- }
- if (sh) cout<<"\n";
- }
- }
- }
- cout<<ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement