Submission #1120736

#TimeUsernameProblemLanguageResultExecution timeMemory
1120736vjudge1Palindrome-Free Numbers (BOI13_numbers)C++14
0 / 100
1086 ms512 KiB
#include"bits/stdc++.h"
using namespace std;

using ll = long long;

main() {
    ll A, B;
    cin >> A >> B;

    ll ans = 0;
    for (int i = A; i <= B; i ++) {
        string S = to_string(i);
        int n = S.size();
        int f = 1;
        if (S[1] != S[0]) {
            continue;
        }
        for (int j = 2; j < n; j ++) {
            if (S[j] != S[j - 1] || S[j] != S[j - 2]) {
                continue;
            }
        }
        ans ++;
    }

    cout << ans << endl;
}

Compilation message (stderr)

numbers.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main() {
      | ^~~~
numbers.cpp: In function 'int main()':
numbers.cpp:14:13: warning: unused variable 'f' [-Wunused-variable]
   14 |         int f = 1;
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...