This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// Telebe of adicto yani AzeTurk810
/*
Author: AzeTurk810
Licance: open source(only authors name must be in code)
Begin Time:11/20/2024 20:48
Problem link: https://codeforces.com/problemset/problem/1543/D1
*/
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
using ll= long long;
using ull=unsigned long long;
# define vint vector<int>
//# define endl '\n'
# define range(a,b,c) for(int i=a;i<b;i+=c)
# define arange(a,b,c) for(int i=a;i>b;i-=c)
# define bend(x) (x).begin(),(x).end()
# define pb push_back
# define fori(x) for(int i=0;i<x;i++)
# define forj(y) for(int j=0;j<y;j++)
# define forn(x,c) for(int i=0;i<n;i+=c)
# define ff first
# define ss second
# define INF 1e14
# define printfprs(v) for(int alma = 0;alma<(v).size();alma++){cout<<(v)[alma].ff<< ' '<<(v)[alma].ss<<endl;};
//# define int long long
int n,q,c,cases =0;
int temp;
const int MAXN = 50005;
bool check(string s)
{
string sc = s;
reverse(sc.begin(),sc.end());
return sc == s;
}
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int l,r,ans = 0;
cin>>l>>r;
string s,sc,scc;
for(int i=l;i<=r;i++)
{
bool ok = true;
s = to_string(i);
sc="";
for(int i = 0;i<s.size()-1;i++)
{
sc = "";
scc = "";
if(s.size() > i )
{scc = scc + s[i] ;scc = scc + s[i +1] ;scc = scc + s[ i + 2];}
sc = sc + s[i] ;
sc = sc + s[ i+ 1];
if(check(sc) || check(scc)){
ok = false;
//cout<<sc<< ' '<<scc<< ' '<<s<<endl;
break;
}
}
if(ok) ans++;
}
cout<<ans<<endl;
}
Compilation message (stderr)
numbers.cpp: In function 'int main()':
numbers.cpp:56:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
56 | for(int i = 0;i<s.size()-1;i++)
| ~^~~~~~~~~~~
numbers.cpp:60:25: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
60 | if(s.size() > i )
| ~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |