Submission #1120184

#TimeUsernameProblemLanguageResultExecution timeMemory
1120184vjudge1Palindrome-Free Numbers (BOI13_numbers)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; bool isPalindrome(const string &str) { string s1 = str.substr(0, str.size() / 2 + str.size() % 2); string s2 = str.substr(str.size() / 2); ranges::reverse(s2); return s1 == s2; } template <typename func> bool forAll(const string &str, const func &f) { for (size_t i = 0; i < str.size(); i++) { for (size_t j = 2; j <= str.size() - i; j++) { string substr = str.substr(i, j); if (f(substr)) { return false; } } } return true; } int main() { int a, b, ans = 0; cin >> a >> b; for (int i = a; i <= b; i++) { string str = to_string(i); if (forAll(str, isPalindrome)) { ans++; } } cout << ans << '\n'; }

Compilation message (stderr)

numbers.cpp: In function 'bool isPalindrome(const string&)':
numbers.cpp:7:3: error: 'ranges' has not been declared
    7 |   ranges::reverse(s2);
      |   ^~~~~~