Submission #881783

# Submission time Handle Problem Language Result Execution time Memory
881783 2023-12-01T22:30:47 Z rainboy Palindromes (info1cup18_palindromes) C
100 / 100
140 ms 10068 KB
#include <stdio.h>

int rev(int a) {
	int b = 0;

	while (a > 0) {
		b = b * 10 + a % 10;
		a /= 10;
	}
	return b;
}

int main() {
	int n;
	long long sum;

	scanf("%d", &n);
	sum = 0;
	while (n--) {
		int a;

		scanf("%d", &a);
		if (a == rev(a))
			sum += a;
	}
	printf("%lld\n", sum);
	return 0;
}

Compilation message

palindromes.c: In function 'main':
palindromes.c:17:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
palindromes.c:22:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |   scanf("%d", &a);
      |   ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 424 KB Output is correct
3 Correct 61 ms 5200 KB Output is correct
4 Correct 89 ms 7544 KB Output is correct
5 Correct 129 ms 9844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 38 ms 1680 KB Output is correct
4 Correct 77 ms 3080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 38 ms 1680 KB Output is correct
4 Correct 77 ms 3080 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 2 ms 492 KB Output is correct
7 Correct 65 ms 3412 KB Output is correct
8 Correct 79 ms 3976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 424 KB Output is correct
3 Correct 61 ms 5200 KB Output is correct
4 Correct 89 ms 7544 KB Output is correct
5 Correct 129 ms 9844 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 38 ms 1680 KB Output is correct
9 Correct 77 ms 3080 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 2 ms 492 KB Output is correct
12 Correct 65 ms 3412 KB Output is correct
13 Correct 79 ms 3976 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 5 ms 528 KB Output is correct
16 Correct 48 ms 4180 KB Output is correct
17 Correct 108 ms 8820 KB Output is correct
18 Correct 117 ms 9808 KB Output is correct
19 Correct 118 ms 10068 KB Output is correct
20 Correct 140 ms 9976 KB Output is correct