#pragma GCC optimize ("O3")
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// author: amin_2008
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
#define vi vector<int>
#define vs vector<string>
#define vb vector<bool>
#define vc vector<char>
#define vl vector<ll>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define pb push_back
#define bpc __builtin_popcount
#define pii pair<int, int>
#define pll pair<ll, ll>
#define piii pair<pii, int>
#define vpii vector<pii>
#define vpll vector<pll>
#define vvpii vector<vpii>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define ins insert
#define ts to_string
#define sz(x) (int)(x).size()
#define mp make_pair
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define ld long double
#define ull unsigned long long
#define endl '\n'
#define int ull
using namespace std;
using namespace __gnu_pbds;
using namespace __cxx11;
template<class T> using ordered_set = tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e18;
const int mod = 1e9+7;
const int sz = 5e5+5;
const int N = 500500;
const int logg = 18;
const int P = 40000005;
const int M = 5e5+5;
int a[sz];
bool ispolindrome(int n)
{
string s = ts(n);
string a = s;
reverse(all(a));
return s == a;
}
void solve()
{
int n;
cin >> n;
int sum = 0;
for(int i = 0; i < n; i++)
{
cin >> a[i];
if ( ispolindrome(a[i]) )
sum += a[i];
}
cout << sum << endl;
}
signed main()
{
ios;
//precompute();
int t = 1;
//cin >> t;
while(t--){
solve();
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
52 ms |
4180 KB |
Output is correct |
4 |
Runtime error |
56 ms |
8320 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
432 KB |
Output is correct |
3 |
Correct |
36 ms |
4304 KB |
Output is correct |
4 |
Runtime error |
38 ms |
8528 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
432 KB |
Output is correct |
3 |
Correct |
36 ms |
4304 KB |
Output is correct |
4 |
Runtime error |
38 ms |
8528 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
52 ms |
4180 KB |
Output is correct |
4 |
Runtime error |
56 ms |
8320 KB |
Execution killed with signal 11 |
5 |
Halted |
0 ms |
0 KB |
- |