Submission #676483

#TimeUsernameProblemLanguageResultExecution timeMemory
676483penguin133Palindromic FizzBuzz (NOI19_palindrome)C++17
100 / 100
20 ms1876 KiB
#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)

palindrome.cpp:26:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   26 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...