답안 #931081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
931081 2024-02-21T07:57:58 Z hugsfromadicto Palindromes (info1cup18_palindromes) C++14
100 / 100
216 ms 17820 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mxN = 1e6+1;
int a[mxN];

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



void _()
{
    int n,sum = 0;
    cin >> n;
    for(int i = 0; i < n; ++i)
    {
        cin >> a[i];
        if(isp(a[i]))
            sum += a[i];
    }
    cout << sum;
}

main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);

  int tc = 1;
  //cin>>tc;
  while(tc--)
  {
      _();
  }

}


Compilation message

palindromes.cpp: In function 'bool isp(long long int)':
palindromes.cpp:16:22: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |     for(int i = 0; i < v.size(); ++i)
      |                    ~~^~~~~~~~~~
palindromes.cpp: At global scope:
palindromes.cpp:41:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   41 | main()
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 152 ms 13908 KB Output is correct
5 Correct 216 ms 17748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 42 ms 5968 KB Output is correct
4 Correct 83 ms 11092 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 42 ms 5968 KB Output is correct
4 Correct 83 ms 11092 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 92 ms 9712 KB Output is correct
8 Correct 114 ms 12008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 101 ms 9328 KB Output is correct
4 Correct 152 ms 13908 KB Output is correct
5 Correct 216 ms 17748 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 42 ms 5968 KB Output is correct
9 Correct 83 ms 11092 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 92 ms 9712 KB Output is correct
13 Correct 114 ms 12008 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 7 ms 2908 KB Output is correct
16 Correct 83 ms 8556 KB Output is correct
17 Correct 181 ms 16124 KB Output is correct
18 Correct 209 ms 17820 KB Output is correct
19 Correct 204 ms 17688 KB Output is correct
20 Correct 205 ms 17772 KB Output is correct