# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
676483 | penguin133 | Palindromic FizzBuzz (NOI19_palindrome) | C++17 | 20 ms | 1876 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
bool f(int x){
stack<int>s;
int e = x, cnt = 0;
while(e)e /= 10, cnt++;
int a = x;
for(int i=1;i<=cnt/2;i++){
s.push(a%10);
a /= 10;
}
int ch =1;
int g = 0;
if(cnt%2)g++, a /= 10;
for(int i=cnt/2 + 1 + g;i<=cnt;i++){
if(s.top() == a%10)s.pop();
else{
ch = 0;
break;
}
a /= 10;
}
return ch;
}
main(){
int s,e;
cin >> s >> e;
for(int i=s;i<=e;i++){
if(f(i))cout << "Palindrome!\n";
else cout << i << '\n';
}
}
Compilation message (stderr)
# | 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... |