Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int cnt2,cnt5,cnt10,n,i,ans;
  7. cnt2 = 0;
  8. cnt5 = 0;
  9. cnt10 = 0;
  10. ans = 0;
  11.  
  12. cin >> n;
  13. int a[n];
  14. for (i = 0; i < n; i++)
  15. cin >> a[i];
  16.  
  17. for (i = 10; i < n; i++){
  18. cin >> a[i];
  19. if (a[i-10] % 2 == 0)
  20. cnt2++;
  21. if (a[i-10] % 5 == 0)
  22. cnt5++;
  23. if (a[i-10] % 10 == 0)
  24. cnt10++;
  25.  
  26. if (a[i] % 10 == 0)
  27. ans += i-9;
  28. if (a[i] % 2 == 0 && a[i] % 5 != 0)
  29. ans += cnt5;
  30. if (a[i] % 5 == 0 && a[i] % 2 != 0)
  31. ans += cnt2;
  32. if (a[i] % 2 != 0 && a[i] % 5 != 0)
  33. ans+= cnt10;
  34. }
  35.  
  36. cout << ans << endl;
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement