답안 #411776

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
411776 2021-05-25T22:07:32 Z Alexandra Palindromes (info1cup18_palindromes) C++14
100 / 100
134 ms 9924 KB
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <math.h>
#include <algorithm>

using namespace std;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);

	long long int n, a, resp=0;
	cin >> n;
	vector <int> digitos;
	for (int i=0; i<n; i++) {
		string num;
		cin >> num;
		bool palin = true;
		for (int j=0; j<num.size(); j++) {
			if (num[j] != num[num.size()-1-j]) {
				palin = false;
				break;
			}
		}

		if (palin==true) {
			resp += stoi(num);
		}
	}
	cout << resp;
	return 0;
}

Compilation message

palindromes.cpp: In function 'int main()':
palindromes.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for (int j=0; j<num.size(); j++) {
      |                 ~^~~~~~~~~~~
palindromes.cpp:14:19: warning: unused variable 'a' [-Wunused-variable]
   14 |  long long int n, a, resp=0;
      |                   ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 72 ms 5016 KB Output is correct
4 Correct 111 ms 7460 KB Output is correct
5 Correct 134 ms 9892 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 43 ms 1732 KB Output is correct
4 Correct 100 ms 3100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 43 ms 1732 KB Output is correct
4 Correct 100 ms 3100 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 3 ms 332 KB Output is correct
7 Correct 75 ms 3240 KB Output is correct
8 Correct 90 ms 3992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 72 ms 5016 KB Output is correct
4 Correct 111 ms 7460 KB Output is correct
5 Correct 134 ms 9892 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 332 KB Output is correct
8 Correct 43 ms 1732 KB Output is correct
9 Correct 100 ms 3100 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 3 ms 332 KB Output is correct
12 Correct 75 ms 3240 KB Output is correct
13 Correct 90 ms 3992 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 4 ms 588 KB Output is correct
16 Correct 48 ms 4120 KB Output is correct
17 Correct 109 ms 8988 KB Output is correct
18 Correct 134 ms 9896 KB Output is correct
19 Correct 99 ms 9924 KB Output is correct
20 Correct 120 ms 9884 KB Output is correct