aboutsummaryrefslogtreecommitdiff
path: root/codechef/hardCash/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'codechef/hardCash/main.cpp')
-rw-r--r--codechef/hardCash/main.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/codechef/hardCash/main.cpp b/codechef/hardCash/main.cpp
new file mode 100644
index 0000000..2b49804
--- /dev/null
+++ b/codechef/hardCash/main.cpp
@@ -0,0 +1,26 @@
+#include <bits/stdc++.h>
+
+using namespace std;
+
+long long sum(vector<int> v) {
+ long long sum = 0;
+ for(int i = 0; i < v.size(); i++) {
+ sum += v[i];
+ }
+ return sum;
+}
+
+int main() {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int tt;
+ cin >> tt;
+ while (tt--) {
+ int n, k;
+ cin >> n >> k;
+ vector<int> v(n);
+ for (int &x : v)
+ cin >> x;
+ cout << sum(v) % k << '\n';
+ }
+}