답안 #915804

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
915804 2024-01-24T17:51:01 Z andrei_iorgulescu Palindromes (info1cup18_palindromes) C++14
100 / 100
470 ms 10068 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

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

signed main()
{
    int n,sm = 0;
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        int x;
        cin >> x;
        if (palin(x) == true)
            sm += x;
    }
    cout << sm;
    return 0;
}

Compilation message

palindromes.cpp: In function 'bool palin(long long int)':
palindromes.cpp:15:23: 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]
   15 |     for (int i = 0; i < dig.size(); i++)
      |                     ~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 210 ms 5020 KB Output is correct
4 Correct 307 ms 7504 KB Output is correct
5 Correct 470 ms 10016 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 89 ms 1676 KB Output is correct
4 Correct 187 ms 3256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 89 ms 1676 KB Output is correct
4 Correct 187 ms 3256 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 5 ms 348 KB Output is correct
7 Correct 180 ms 3352 KB Output is correct
8 Correct 221 ms 4180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 210 ms 5020 KB Output is correct
4 Correct 307 ms 7504 KB Output is correct
5 Correct 470 ms 10016 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 89 ms 1676 KB Output is correct
9 Correct 187 ms 3256 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 5 ms 348 KB Output is correct
12 Correct 180 ms 3352 KB Output is correct
13 Correct 221 ms 4180 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 13 ms 604 KB Output is correct
16 Correct 176 ms 4112 KB Output is correct
17 Correct 382 ms 8868 KB Output is correct
18 Correct 416 ms 9908 KB Output is correct
19 Correct 408 ms 10068 KB Output is correct
20 Correct 427 ms 10008 KB Output is correct