From 5555c7da69b13eb9f6c81c21e6d0f5a5cc702b08 Mon Sep 17 00:00:00 2001 From: Omar Magdy Date: Fri, 24 Jun 2022 13:49:34 +0200 Subject: Solved a problem from codechef --- codechef/copsAndTheifDevu/inp | 0 codechef/copsAndTheifDevu/main | Bin 0 -> 43304 bytes codechef/copsAndTheifDevu/main.cpp | 24 ++++++++++++++++++++++++ codechef/copsAndTheifDevu/main_input0.txt | 7 +++++++ codechef/copsAndTheifDevu/main_output0.txt | 3 +++ 5 files changed, 34 insertions(+) create mode 100644 codechef/copsAndTheifDevu/inp create mode 100755 codechef/copsAndTheifDevu/main create mode 100644 codechef/copsAndTheifDevu/main.cpp create mode 100644 codechef/copsAndTheifDevu/main_input0.txt create mode 100644 codechef/copsAndTheifDevu/main_output0.txt (limited to 'codechef/copsAndTheifDevu') diff --git a/codechef/copsAndTheifDevu/inp b/codechef/copsAndTheifDevu/inp new file mode 100644 index 0000000..e69de29 diff --git a/codechef/copsAndTheifDevu/main b/codechef/copsAndTheifDevu/main new file mode 100755 index 0000000..c9cc83b Binary files /dev/null and b/codechef/copsAndTheifDevu/main differ 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 + +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 v(m); + for(int &x : v) cin >> x; + set 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; + + } +} diff --git a/codechef/copsAndTheifDevu/main_input0.txt b/codechef/copsAndTheifDevu/main_input0.txt new file mode 100644 index 0000000..b47d21b --- /dev/null +++ b/codechef/copsAndTheifDevu/main_input0.txt @@ -0,0 +1,7 @@ +3 +4 7 8 +12 52 56 8 +2 10 2 +21 75 +2 5 8 +10 51 diff --git a/codechef/copsAndTheifDevu/main_output0.txt b/codechef/copsAndTheifDevu/main_output0.txt new file mode 100644 index 0000000..5e66023 --- /dev/null +++ b/codechef/copsAndTheifDevu/main_output0.txt @@ -0,0 +1,3 @@ +0 +18 +9 -- cgit v1.2.3