fork(1) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long n,a,k;
  7. cin >> n;
  8. long long z[n];
  9. k = 0;
  10. for (int i = n; i>0; i--)
  11. {
  12. cin >> a;
  13. z[i] = a;
  14. }
  15. for (int j = 0 ; j<=n ; j++){
  16. if (z[j] % 5 == 0 && z[j] !=0)
  17. {
  18. cout << z[j];
  19. break;
  20. }
  21. k ++;
  22. }
  23. if (k == n+1 || n==0)
  24. {
  25. cout << "-1";
  26. }
  27.  
  28. return 0;
  29. }
Success #stdin #stdout 0s 4548KB
stdin
5
3 15 24 25 9
stdout
25