diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-31 01:17:07 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-31 01:17:07 +0200 |
| commit | 64951951612753d467823dd5a3ddcc1916ad0a97 (patch) | |
| tree | 713a8ed1e28ff3b76100997248d21ea612e32324 /codechef/hardCash/main.cpp | |
| parent | 3a89fc707253f75f46fd5a4822817f1fd5156c40 (diff) | |
| download | competitive-programming-64951951612753d467823dd5a3ddcc1916ad0a97.tar.xz competitive-programming-64951951612753d467823dd5a3ddcc1916ad0a97.zip | |
Solved hardcash from codechef
Diffstat (limited to 'codechef/hardCash/main.cpp')
| -rw-r--r-- | codechef/hardCash/main.cpp | 26 |
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'; + } +} |
