Submission #1120516

#TimeUsernameProblemLanguageResultExecution timeMemory
1120516vjudge1Palindrome-Free Numbers (BOI13_numbers)C++14
28.33 / 100
1083 ms512 KiB
// author - alimammadzade

#include <bits/stdc++.h>
#define int long long
using namespace std;

bool free(int i) {
    string s = to_string(i);
    for (int i = 0; i < (int)s.size() - 1; i++)
        for (int j = i + 1; j < (int)s.size(); j++) {
            string a = s.substr(i, j - i + 1), b = a;
            reverse(b.begin(), b.end());
            if (a == b) return 0;
        }
    return 1;
}

signed main() {
    // cin.tie(nullptr)->sync_with_stdio(false);
    // system("cls"), freopen("in.txt", "r", stdin);
    int a, b, res = 0;
    scanf("%lld %lld", &a, &b);
    for (int i = a; i <= b; i++) res += free(i);
    printf("%lld", res);
}

Compilation message (stderr)

numbers.cpp: In function 'int main()':
numbers.cpp:22:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |     scanf("%lld %lld", &a, &b);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...