diff --git a/CodeChef/FEB15/PRICECON.cpp b/CodeChef/FEB15/PRICECON.cpp new file mode 100644 index 0000000..6c8e658 --- /dev/null +++ b/CodeChef/FEB15/PRICECON.cpp @@ -0,0 +1,32 @@ +#include +using namespace std; +int main() +{ + int t; + cin >> t; + while (t--) + { + int sum1 = 0; + int sum2 = 0; + int n, k; + cin >> n >> k; + vector a; + for (int i = 0; i < n; i++) + { + int s; + cin >> s; + a.push_back(s); + } + for (int i = 0; i < n; i++) + sum1 += a[i]; + for (int i = 0; i < n; i++) + { + if (a[i] > k) + a[i] = k; + } + for (int i = 0; i < n; i++) + sum2 += a[i]; + cout << abs(sum1 - sum2) << endl; + } + return 0; +}