summaryrefslogblamecommitdiffstats
path: root/inf/lige/3/4.c
blob: d92ebd31678a003c4c7018123175db150ad66428 (plain) (tree)


































































                                               
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define I unsigned long long int
/*
I nasl (I cur) {
	char buf[255];
	int len = sprintf(buf, cur);
	I tmp = cur;
	I cnt = 0;
	while (tmp % 10 == 9) {
		cnt++;
		if (tmp == 9)
			return pow(10, cnt)+1;
		tmp /= 10;
	}
	for (int i = 0; i < len/2; i++)
		buf[len-i-1] = buf[i];
	if (atoll(buf) <= cur) {
		int i = len/2-1;
		int j = len/2;
		int carry = 0;
		while (i >= 0) {
			if (buf[i] == '9') {
				buf[i] = '0';
				carry++;
			}
			buf[j++] = buf[i--];
		}
		if (buf[len/2] == '9') {
			if len
			buf[len/2] = '0';
			buf[len/2] = '0';
		}
	}
}
*/
int main (void) {
	char buf[255];
	fgets(buf, 255, stdin);
	char * c = buf;
	I z = strtoull(c, &c, 10);
	c++;
	I k = strtoull(c, &c, 10);
	// I palind = nasl(z-1);
	for (I i = z; i <= k; i++) {
		/* if (i == palind) {
			puts("Palindrom!\n");
			palind = nasl(i);
			continue;
		} */
		char s[512];
		int l = sprintf(s, "%llu", i);
		if (l < 1) {
			puts("Palindrom!");
			continue;
		}
		for (int j = 0; j < l/2; j++)
			if (s[j] != s[l-j-1]) {
				puts(s);
				goto c;
			}
		puts("Palindrom!");
		c:
		;
	}
}