Untitled
unknown
plain_text
a year ago
552 B
2
Indexable
Never
#include <iostream> #include <regex> int main() { std::regex pattern("^10*$"); // regex pattern to match binary strings that represent powers of 2 int n; // number of test strings std::cin >> n; for (int i = 0; i < n; i++) { std::string s; std::cin >> s; // Check if the string matches the pattern if (std::regex_match(s, pattern)) { std::cout << "True" << std::endl; } else { std::cout << "False" << std::endl; } } return 0; }