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 | |
| parent | 3d2f75923401460e4c8e8b56e4a24b5a2e065592 (diff) | |
| download | competitive-programming-72d3a7d06e137c5ab420f8fe131ee50ae585f9f5.tar.xz competitive-programming-72d3a7d06e137c5ab420f8fe131ee50ae585f9f5.zip | |
Solved two problem in codechef
| -rw-r--r-- | codechef/chefAndIpcCertificates.cpp | 22 | ||||
| -rw-r--r-- | codechef/chefInVaccinationQueue.cpp | 26 |
2 files changed, 48 insertions, 0 deletions
diff --git a/codechef/chefAndIpcCertificates.cpp b/codechef/chefAndIpcCertificates.cpp new file mode 100644 index 0000000..03e93c7 --- /dev/null +++ b/codechef/chefAndIpcCertificates.cpp @@ -0,0 +1,22 @@ +#include <bits/stdc++.h> + +using namespace std; + +int main() { + ios_base::sync_with_stdio(false); + cin.tie(NULL); + int n, m, k; + cin >> n >> m >> k; + int ans = 0; + for (int i = 0; i < n; i++) { + vector<int> v(k); + for (int &x : v) + cin >> x; + int q; + cin >> q; + if (accumulate(v.begin(), v.end(), 0) >= m && q <= 10) { + ans++; + } + } + cout << ans << '\n'; +} 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; + } +} |
