Promi_38

cf 1471A

Jan 6th, 2021
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main()
  4. {
  5.     int t;
  6.     scanf("%d", &t);
  7.    
  8.     while(t--)
  9.     {
  10.         long long n, x, i;
  11.         scanf("%lld %lld", &n, &x);
  12.         long long a[n];
  13.         for(i = 0; i < n; i++) scanf("%lld", &a[i]);
  14.        
  15.         long long s = 0, s1 = 0;
  16.         for(i = 0; i < n; i++)
  17.         {
  18.             s += a[i];
  19.             if(a[i] % x != 0) s1 += (a[i] / x) + 1;
  20.             else s1 += a[i] / x;
  21.         }
  22.         if(s % x != 0) printf("%lld %lld\n", (s/x) + 1, s1);
  23.         else printf("%lld %lld\n", (s/x), s1);
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment