Submission #121536

#TimeUsernameProblemLanguageResultExecution timeMemory
121536pamajPalindrome-Free Numbers (BOI13_numbers)C++14
31.67 / 100
1089 ms396 KiB
#include <bits/stdc++.h> using namespace std; bool check(string a) { int n = a.size(); for(int i = 0; i < n - 1; i++) { for(int p = i + 1; p < n; p++) { bool ok = true; for(int j = 0; j <= (p - i)/2; j++) { //cout << i << " " << p << " " << j <<"\n"; if(a[i + j] != a[p - j]) ok = false; } if(ok) return true; } } return false; } int main() { long long a, b; cin >> a >> b; int cont = 0; for(long long i = a; i <= b; i++) { string x = to_string(i); bool t = check(x); //cout << x << " " << t << "\n"; if(t) cont++; } cout << b - a + 1 - cont << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...