Submission #1129401

#TimeUsernameProblemLanguageResultExecution timeMemory
1129401jackofall718Palindromic FizzBuzz (NOI19_palindrome)C++20
100 / 100
23 ms1864 KiB
//2019 NOI prelim
#include <bits/stdc++.h>
using namespace std;

long long S, E;

bool is_palindrome(long long x) {
	vector<int> v;
	while (x > 0) {
		v.push_back(x%10);
		x /= 10;
	}
	for (int i = 0; i < v.size(); i++) if (v[i] != v[v.size() - i - 1]) return false;
	return true;
}

int main() {
	scanf("%lld%lld", &S, &E);
	for (long long i = S; i <= E; i++) {
		if (is_palindrome(i)) printf("Palindrome!\n");
		else printf("%lld\n", i);
	}
}

Compilation message (stderr)

palindrome.cpp: In function 'int main()':
palindrome.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |         scanf("%lld%lld", &S, &E);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~
#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...