Sort by

recency

|

134 Discussions

|

  • + 0 comments

    By this practice and the following answers, now I remeber again some topics that for a while, I forgot them. Thanks everybody for the solutions.

  • + 0 comments

    clean I think

    template<bool F, bool ...I>
    int reversed_binary_value()
    {
        return F + 2 * reversed_binary_value<I...>();
    }
    
    template<>
    int reversed_binary_value<0>()
    {
        return 0;
    }
    
    template<>
    int reversed_binary_value<1>()
    {
        return 1;
    }
    
  • + 0 comments

    That the task was mentioning the input format was not necessary and thus confusing! First problem I solved.

  • + 0 comments

    trying to understand this question is making me vomiting blood

  • + 0 comments
    template <bool...digits>
    int reversed_binary_value(){
        bool arr[] = {digits...};
        int sum = 0;
        int a = 0;
        for(bool i : arr){
            sum = sum | ((1&i) << a++);
        }
        return sum;
    }