Submission #584138

#TimeUsernameProblemLanguageResultExecution timeMemory
584138OlympiaPalindrome-Free Numbers (BOI13_numbers)C++17
34.17 / 100
1095 ms320 KiB
#include <bits/stdc++.h>
using namespace std;
int main() {
    int64_t a, b;
    cin >> a >> b;
    int ans = 0;
    for (int i = a; i <= b; i++) {
        string s = to_string(i);
        bool fine = true;
        for (int j = 0; j < s.length(); j++) {
            if (j >= 1 && s[j] == s[j - 1]) {
                fine = false;
            }
            if (j >= 2 && s[j] == s[j - 2]) {
                fine = false;
            }
        }
        ans += fine;
    }
    cout << ans << '\n';
}

Compilation message (stderr)

numbers.cpp: In function 'int main()':
numbers.cpp:10:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |         for (int j = 0; j < s.length(); j++) {
      |                         ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...