답안 #80805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
80805 2018-10-22T11:20:09 Z farukkastamonuda Palindromes (info1cup18_palindromes) C++14
100 / 100
288 ms 10236 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000000
#define md 1000000007
#define li 2005
#define mp make_pair
#define pb push_back
using namespace std;
int n, x, xx;
lo int sum;
vector < int > v;
int main(){
	scanf("%d", &n);
	for(int i = 1;i <= n; i++){
		scanf("%d", &x);
		xx = x;
		//vector< int > v;
		while(x){
			v.pb(x % 10);
			x /= 10;
		}
		int flag = 0;
		int bas = 0, son = (int)v.size() - 1;
		while(bas < son){
			if(v[bas] != v[son]){
				flag = 1;
				break;
			}
			bas++;
			son--;
		}
		if(flag == 0) sum += xx;
		v.clear();
	}
	printf("%lld", sum);
	return 0;
}

Compilation message

palindromes.cpp: In function 'int main()':
palindromes.cpp:15:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
palindromes.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 118 ms 584 KB Output is correct
4 Correct 182 ms 584 KB Output is correct
5 Correct 250 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 584 KB Output is correct
2 Correct 3 ms 584 KB Output is correct
3 Correct 59 ms 584 KB Output is correct
4 Correct 135 ms 584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 584 KB Output is correct
2 Correct 3 ms 584 KB Output is correct
3 Correct 59 ms 584 KB Output is correct
4 Correct 135 ms 584 KB Output is correct
5 Correct 2 ms 584 KB Output is correct
6 Correct 6 ms 584 KB Output is correct
7 Correct 154 ms 584 KB Output is correct
8 Correct 128 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 5 ms 380 KB Output is correct
3 Correct 118 ms 584 KB Output is correct
4 Correct 182 ms 584 KB Output is correct
5 Correct 250 ms 584 KB Output is correct
6 Correct 2 ms 584 KB Output is correct
7 Correct 3 ms 584 KB Output is correct
8 Correct 59 ms 584 KB Output is correct
9 Correct 135 ms 584 KB Output is correct
10 Correct 2 ms 584 KB Output is correct
11 Correct 6 ms 584 KB Output is correct
12 Correct 154 ms 584 KB Output is correct
13 Correct 128 ms 596 KB Output is correct
14 Correct 2 ms 596 KB Output is correct
15 Correct 9 ms 596 KB Output is correct
16 Correct 91 ms 596 KB Output is correct
17 Correct 225 ms 596 KB Output is correct
18 Correct 288 ms 736 KB Output is correct
19 Correct 231 ms 736 KB Output is correct
20 Correct 240 ms 10236 KB Output is correct