From 905f698f210b0b4d14e0fde414137a19b141f0ef Mon Sep 17 00:00:00 2001 From: Arjun Singh <61823639+arjunsingh64@users.noreply.github.com> Date: Thu, 1 Oct 2020 00:56:44 +0530 Subject: [PATCH] Add files via upload August Long Challenge Codechef --- .../FifthSolution_CHEFWED.cpp | 39 ++++++++++ .../FirstSolution_CHEFWARS.java | 38 ++++++++++ .../FourthSolution_AUG20B.cpp | 71 +++++++++++++++++++ .../SecondSolution_LINCHESS.java | 44 ++++++++++++ .../ThirdSolution_CRDGAME3.java | 46 ++++++++++++ 5 files changed, 238 insertions(+) create mode 100644 AUGUST LONG CHALLENGE/FifthSolution_CHEFWED.cpp create mode 100644 AUGUST LONG CHALLENGE/FirstSolution_CHEFWARS.java create mode 100644 AUGUST LONG CHALLENGE/FourthSolution_AUG20B.cpp create mode 100644 AUGUST LONG CHALLENGE/SecondSolution_LINCHESS.java create mode 100644 AUGUST LONG CHALLENGE/ThirdSolution_CRDGAME3.java diff --git a/AUGUST LONG CHALLENGE/FifthSolution_CHEFWED.cpp b/AUGUST LONG CHALLENGE/FifthSolution_CHEFWED.cpp new file mode 100644 index 0000000..860f590 --- /dev/null +++ b/AUGUST LONG CHALLENGE/FifthSolution_CHEFWED.cpp @@ -0,0 +1,39 @@ +#include +using namespace std; + +int main() +{ + + int t; + cin>>t; + + while(t--) + { + int n,k; + cin>>n>>k; + + if(k==1) + { + int hash[101]; + memset(hash,0,sizeof(hash)); + int count=1; + int temp; + for(int i=0;i>temp; + if(hash[temp]<1) + hash[temp]++; + else + { + count++; + memset(hash,0,sizeof(hash)); + hash[temp]++; + } + } + + + cout< 0) + { + int health = sc.nextInt(); + int power = sc.nextInt(); + + while(true) + { + health = health - power; + power = power/2; + + if(health <= 0) + { + System.out.println(1); + break; + }else if(power <= 0) + { + System.out.println(0); + break; + } + } + } + } +} + diff --git a/AUGUST LONG CHALLENGE/FourthSolution_AUG20B.cpp b/AUGUST LONG CHALLENGE/FourthSolution_AUG20B.cpp new file mode 100644 index 0000000..4fe4bae --- /dev/null +++ b/AUGUST LONG CHALLENGE/FourthSolution_AUG20B.cpp @@ -0,0 +1,71 @@ +#include +using namespace std; + + +int main() +{ + + int tc; + cin>>tc; + + string se,p; + vector x; + int j=0,flag,z; + + while(tc--) + { + j=0,z=0; + flag=0; + cin>>se>>p; + int hash[26]={0}; + if(se.length()==1) + { + cout< x; + + for(int i=0;i<26;i++) + for(int j=0;jp[z]) + { + if(*i==p[0] && *(i+1)!=*i) + { + cout< 0) + { + int n = sc.nextInt(); + int k = sc.nextInt(); + int cnt=0; + int min=9999999; + int val,result=0; + int [] arr = new int[n]; + for(int i=0;i 0) + { + int p1=0; + int p2=0; + int c = sc.nextInt(); + int r = sc.nextInt(); + + if(c<=9) + p1=1; + else + { + p1 = c/9; + if(c%9!=0) + p1=p1+1; + } + if(r<=9) + p2=1; + else + { + p2 = r/9; + if(r%9!=0) + p2=p2+1; + } + if(p1