From 840ea1e3154910e38892d689335ee9837fb1db26 Mon Sep 17 00:00:00 2001 From: Krishna Pal Deora <47516664+krishnapalS@users.noreply.github.com> Date: Sun, 11 Oct 2020 17:47:05 +0530 Subject: [PATCH] aggressive cows c++ code implementation --- Aggressive_Cows/Aggressive_Cows.cpp | 82 +++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Aggressive_Cows/Aggressive_Cows.cpp diff --git a/Aggressive_Cows/Aggressive_Cows.cpp b/Aggressive_Cows/Aggressive_Cows.cpp new file mode 100644 index 0000000000..ee9f5efde1 --- /dev/null +++ b/Aggressive_Cows/Aggressive_Cows.cpp @@ -0,0 +1,82 @@ +#include +using namespace std; + +int binarysearch(int *a,int last,int s,int e,int n,int minm) +{ + + if(e>1; + if(a[mid]-last==minm) + return mid; + else if(a[mid]-last=mid) + { + lastpos=i; + if(++till==c) + return true; + } + i++; + } + if(till==c) + return true; + return false; +} +*/ +int main() +{ + int t; + scanf("%d",&t); + while(t--) + { + int n,c; + scanf("%d%d",&n,&c); + int i,a[n]; + for(i=0;i1) + { + mid=(start+end)>>1; + // cout<<"start"<