#include <bits/stdc++.h>
#include <chrono>
#define ll long long int
#define endl '\n'
#define vn vector<ll>
#define vi vector<pair <ll,ll>>
using namespace std;
using namespace std::chrono;
const int MAX_N = 1e9 + 7;
#define pii pair<ll,ll>
const ll INF = 0x3f3f3f3f3f3f3f3f;
#define pb push_back
#define srt(vp) sort(vp.begin(), vp.end())
bool is_palindrome (ll n){
if (n <=9)return true;
else{
ll check = true;
vn s;
while (n != 0){
ll num = n % 10;
n /= 10;
s.pb(num);
}
if (s.size()%2==0){
for (int i=0;i<s.size()/2;i++){
if (s[i]==s[s.size()-1-i])continue;
else {
check=false;
break;
}
}
}
else{
for (int i=0;i<s.size()/2;i++){
if (s[i]==s[s.size()-1-i])continue;
else{
check=false;
break;
}
}
}
return check;
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
auto start = high_resolution_clock::now();
ll s,e;
cin>>s>>e;
for (int i=s;i<=e;i++){
if (is_palindrome(i))cout<<"Palindrome!"<<endl;
else cout<<i<<endl;
}
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
//cout << "Time taken by function: " << duration.count() << " microseconds" << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |