Advertisement
jakaria_hossain

codechef - chef and price control

Jun 11th, 2020
886
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define fast()(ios_base::sync_with_stdio(0),cin.tie(NULL));
  5. int main()
  6. {
  7.     fast()
  8.     int t;
  9.     cin>>t;
  10.     while(t--)
  11.     {
  12.         int n,k;
  13.         cin>>n>>k;
  14.         int sum =0;
  15.         for(int i=0;i<n;i++)
  16.         {
  17.             int x;
  18.             cin>>x;
  19.             if(x>k)sum+=(x-k);
  20.         }
  21.         cout<<sum<<endl;
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement