lina_os

Untitled

Dec 17th, 2024
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  10. int n, k;
  11. cin >> n >> k;
  12. int arr[n];
  13. long long sum=0;
  14. int mod[n];
  15. for (int i=0; i<n; i++) {
  16. cin >> arr[i];
  17. mod[i]=arr[i]%k;
  18. }
  19. for (int i=0; i<n; i++) {
  20. sum+=mod[i];
  21. }
  22. if (sum % k == 0) cout << "YES";
  23. else cout << "NO";
  24. return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment