aboutsummaryrefslogtreecommitdiff
path: root/codechef/copsAndTheifDevu/main.cpp
diff options
context:
space:
mode:
authorOmar Magdy <omar.professional8777@gmail.com>2022-06-24 13:49:34 +0200
committerOmar Magdy <omar.professional8777@gmail.com>2022-06-24 13:49:34 +0200
commit5555c7da69b13eb9f6c81c21e6d0f5a5cc702b08 (patch)
tree65628c828872d95f483982ce37644e0ac9420393 /codechef/copsAndTheifDevu/main.cpp
parent42013225064413fdb31599d1b3304065c3964707 (diff)
downloadcompetitive-programming-5555c7da69b13eb9f6c81c21e6d0f5a5cc702b08.tar.xz
competitive-programming-5555c7da69b13eb9f6c81c21e6d0f5a5cc702b08.zip
Solved a problem from codechef
Diffstat (limited to 'codechef/copsAndTheifDevu/main.cpp')
-rw-r--r--codechef/copsAndTheifDevu/main.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/codechef/copsAndTheifDevu/main.cpp b/codechef/copsAndTheifDevu/main.cpp
new file mode 100644
index 0000000..914c012
--- /dev/null
+++ b/codechef/copsAndTheifDevu/main.cpp
@@ -0,0 +1,24 @@
+#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 m, x, y;
+ cin >> m >> x >> y;
+ vector<int> v(m);
+ for(int &x : v) cin >> x;
+ set<int> st;
+ for(int i = 0; i < v.size(); i++) {
+ for(int j = max(v[i] - (x * y) - 1, 0); j < min(v[i] + (x * y), 100); j++) {
+ st.insert(j);
+ }
+ }
+ cout << 100 - st.size() << endl;
+
+ }
+}