Search
 
SCRIPT & CODE EXAMPLE
 

CPP

cpp-variadics/problem?

#include <iostream>
using namespace std;

// Enter your code for reversed_binary_value<bool...>()
template <bool a> int reversed_binary_value() { return a; }

template <bool a, bool b, bool... d> int reversed_binary_value() {
  return (reversed_binary_value<b, d...>() << 1) + a;
}


template <int n, bool...digits>
struct CheckValues {
    static void check(int x, int y)
    {
        CheckValues<n-1, 0, digits...>::check(x, y);
        CheckValues<n-1, 1, digits...>::check(x, y);
    }
};

template <bool...digits>
struct CheckValues<0, digits...> {
    static void check(int x, int y)
    {
        int z = reversed_binary_value<digits...>();
        std::cout << (z+64*y==x);
    }
};

int main()
{
    int t; std::cin >> t;

    for (int i=0; i!=t; ++i) {
        int x, y;
        cin >> x >> y;
        CheckValues<6>::check(x, y);
        cout << "
";
    }
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to convert malloc function to cpp 
Cpp :: pass address to function c++ 
Cpp :: read large files part by part in C++ 
Cpp :: C++ thread header 
Cpp :: pycuda install failed microsoft c++ 
Cpp :: Initialize Vector Iterator with begin() function 
Cpp :: ue4 foreach loop c++ 
Cpp :: comment savoir si un nombre est premier c++ 
Cpp :: how to define a node in c++ 
Cpp :: cpp full form 
Cpp :: 5 program code in c++ of friend function 
Cpp :: c++ format number thousands separator 
Cpp :: log like printf c++ 
Cpp :: vprintf 
Cpp :: permutation and combination program in c++ 
Cpp :: kruskal algorithm in c++ 
Cpp :: error when using template base class members 
Cpp :: c++ login 
Cpp :: online compiler cpp 
Cpp :: auto i cpp 
Cpp :: int to string Using to_string method 
Cpp :: convert from hex to decimal c++ 
Cpp :: how to make an enum in c++ 
Cpp :: flags of open operation c++ 
C :: csrf_exempt 
C :: buble sort c 
C :: zizag c 
C :: how to search in a file in c 
C :: Calculator_C 
C :: search array element in c 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =