Submission #1122310

#TimeUsernameProblemLanguageResultExecution timeMemory
1122310I_love_BanuPalindromes (info1cup18_palindromes)C++14
100 / 100
251 ms10068 KiB
#include"bits/stdc++.h"
using namespace std;

using ll = long long;

#define FOR(i, a) for(int i=0;i<(a);i++)

main() {
    int N;
    cin >> N;

    ll ans = 0;
    FOR(i, N) {
        string S;
        cin >> S;

        string T = S;
        reverse(begin(T),end(T));

        int f = 1;
        int M = S.size();
        FOR(j, M) {
            if (S[j] != T[j]) {
                f = 0;
            }
        }

        if (f) {
            ans += stoll(S);
        }
    }

    cout << ans << endl;
}

Compilation message (stderr)

palindromes.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...