diff options
| author | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-29 19:37:41 +0200 |
|---|---|---|
| committer | Omar Magdy <omar.professional8777@gmail.com> | 2022-05-29 19:37:41 +0200 |
| commit | 72d3a7d06e137c5ab420f8fe131ee50ae585f9f5 (patch) | |
| tree | 2bebcf7245bd75989aa6a7c0bf784294c86a3c63 /codechef/chefInVaccinationQueue.cpp | |
| parent | 3d2f75923401460e4c8e8b56e4a24b5a2e065592 (diff) | |
| download | competitive-programming-72d3a7d06e137c5ab420f8fe131ee50ae585f9f5.tar.xz competitive-programming-72d3a7d06e137c5ab420f8fe131ee50ae585f9f5.zip | |
Solved two problem in codechef
Diffstat (limited to 'codechef/chefInVaccinationQueue.cpp')
| -rw-r--r-- | codechef/chefInVaccinationQueue.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/codechef/chefInVaccinationQueue.cpp b/codechef/chefInVaccinationQueue.cpp new file mode 100644 index 0000000..eb2bfdd --- /dev/null +++ b/codechef/chefInVaccinationQueue.cpp @@ -0,0 +1,26 @@ +#include <bits/stdc++.h> + +using namespace std; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int tt; + cin >> tt; + while (tt--) { + int n, p, x, y; + cin >> n >> p >> x >> y; + vector<int> v(n); + int ans = 0; + for (int &x : v) + cin >> x; + for (int i = 0; i < p; i++) { + if (v[i] == 0) { + ans += x; + } else { + ans += y; + } + } + cout << ans << endl; + } +} |
