Submission #425468

#TimeUsernameProblemLanguageResultExecution timeMemory
425468errorgornPalindromic FizzBuzz (NOI19_palindrome)C++17
100 / 100
24 ms1812 KiB
#include <cstdio> #include <vector> using namespace std; long long n,m; vector<int> v; bool p(long long i){ v.clear(); while (i!=0){ v.push_back(i%10); i/=10; } for (int x=0;x<(v.size()+1)>>1;x++){ if (v[x]!=v[v.size()-1-x]) return false; } return true; } int main(){ scanf("%lld%lld",&n,&m); for (long long x=n;x<=m;x++){ (p(x)? printf("Palindrome!\n"): printf("%lld\n",x)); } }

Compilation message (stderr)

palindrome.cpp: In function 'bool p(long long int)':
palindrome.cpp:12:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for (int x=0;x<(v.size()+1)>>1;x++){
      |                ~^~~~~~~~~~~~~~~~
palindrome.cpp: In function 'int main()':
palindrome.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%lld%lld",&n,&m);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
#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...