From 159d2954abfdd9d7e8d1dae6d44218862797315e Mon Sep 17 00:00:00 2001 From: Plabon Kumar saha <46686524+PlabonKumarsaha@users.noreply.github.com> Date: Fri, 24 May 2019 22:28:17 +0600 Subject: [PATCH] Add files via upload --- aggresive cows SPOJ.cpp | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 aggresive cows SPOJ.cpp diff --git a/aggresive cows SPOJ.cpp b/aggresive cows SPOJ.cpp new file mode 100644 index 0000000..fd0bdaf --- /dev/null +++ b/aggresive cows SPOJ.cpp @@ -0,0 +1,67 @@ +#include +#include +#include +#include +using namespace std; +int v1[100002]; +int p,q; +bool solution(int var) +{ +int st = v1[0]; +int cow =1; +for(int i =0;i=var) + { + cow++; + if(cow == q) + return true; + st = v1[i]; + + } +} +return false; +} +int binarySearch() +{ + int fi =0; //0 <= xi <= 1,000,000,000) + int la = v1[p -1]; + // cout<<"p = "<>test; +while(test--) +{ + cin>>p>>q; + for(int j=0 ;j>v1[j]; + + sort(v1,v1+p); + + printf("%d\n", binarySearch()); + + + +} + + return 0; +}