Submission #1121035

#TimeUsernameProblemLanguageResultExecution timeMemory
1121035raul2008487Palindrome-Free Numbers (BOI13_numbers)C++17
38.33 / 100
1074 ms508 KiB
#include<bits/stdc++.h> #define ll long long #define pb push_back #define in insert #define fi first #define se second #define vl vector<ll> #define all(v) v.begin(), v.end() #define endl "\n" using namespace std; const int sz = 1e6 + 5; /// mind this const int MAX = 2e6 + 123; const int BS = 61; const int mod = 998244353; void solve(){ ll a, b, i, j, ans = 0; cin >> a >> b; for(i = a; i <= b; i++){ ll x = i; bool ok = 1; while(x > 10){ ll m = (x % 1000); if(x > 100)ok &= ((ll)(m % 10) != (ll)(m / 100)); m = (x % 100); ok &= ((ll)(m % 10) != (ll)(m / 10)); if(!ok){break;} x /= 10; } ans += ok; } cout << ans << endl; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll t = 1; // cin >> t; while(t--){ solve(); } } /* 123 321 */

Compilation message (stderr)

numbers.cpp: In function 'void solve()':
numbers.cpp:19:17: warning: unused variable 'j' [-Wunused-variable]
   19 |     ll a, b, i, j, ans = 0;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...