Submission #98108

#TimeUsernameProblemLanguageResultExecution timeMemory
98108tushar_2658Palindromes (info1cup18_palindromes)C++14
100 / 100
391 ms12308 KiB
#include "bits/stdc++.h" using namespace std; typedef long long ll; #define file freopen("in.txt", "r", stdin); const int maxn = 1e6 + 5; ll arr[maxn], sum = 0; int n; bool check(ll n){ string s = to_string(n); string s1 = s; reverse(s.begin(), s.end()); return (s == s1); } int main(){ //file scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%lld", &arr[i]); } for(int i=0; i<n; i++){ if(check(arr[i]))sum += arr[i]; } printf("%lld\n", sum); }

Compilation message (stderr)

palindromes.cpp: In function 'int main()':
palindromes.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
palindromes.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld", &arr[i]);
         ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...