Untitled
#include<vector> #include<iostream> using namespace std; int answer = 0; void checkZeroNumber(vector<uint8_t>& vec, uint64_t num) { vec[num] = vec[num/2]; if (num % 2 == 0) { vec[num]++; } if (vec[num] == 9) answer++; } int main() { vector<uint8_t> vec; vec.reserve(1000000000 + 1); vec[0] = 6; for (uint64_t num = 1; num < 1000000000; num++) { checkZeroNumber(vec, num); } cout << "Result " << answer << endl; return 0; }