From 21e8dd0a19bda4edb0e30768ff2bceacaa2b84af Mon Sep 17 00:00:00 2001 From: nikitanagrale <72974891+nikitanagrale@users.noreply.github.com> Date: Fri, 16 Oct 2020 17:10:29 +0530 Subject: [PATCH] added solutions to codeforces problems. added solutions for 800 rated problems. --- Codeforces/141A_Amusing_Joke.cpp | 15 ++++++++ Codeforces/144A_Arrival_of_the_General.cpp | 36 +++++++++++++++++++ Codeforces/148A_Insomnia_Cure.cpp | 20 +++++++++++ Codeforces/155A_I_love_%username.cpp | 29 +++++++++++++++ Codeforces/158A_Next_Round.cpp | 22 ++++++++++++ Codeforces/200B_Drinks.cpp | 18 ++++++++++ ...8A_Is_your_horseshoe_on_the_other_hoof.cpp | 18 ++++++++++ Codeforces/231A_Team.cpp | 17 +++++++++ Codeforces/236A_Boy_or_Girl.cpp | 14 ++++++++ Codeforces/263A_Beautiful_Matrix.cpp | 20 +++++++++++ 10 files changed, 209 insertions(+) create mode 100644 Codeforces/141A_Amusing_Joke.cpp create mode 100644 Codeforces/144A_Arrival_of_the_General.cpp create mode 100644 Codeforces/148A_Insomnia_Cure.cpp create mode 100644 Codeforces/155A_I_love_%username.cpp create mode 100644 Codeforces/158A_Next_Round.cpp create mode 100644 Codeforces/200B_Drinks.cpp create mode 100644 Codeforces/228A_Is_your_horseshoe_on_the_other_hoof.cpp create mode 100644 Codeforces/231A_Team.cpp create mode 100644 Codeforces/236A_Boy_or_Girl.cpp create mode 100644 Codeforces/263A_Beautiful_Matrix.cpp diff --git a/Codeforces/141A_Amusing_Joke.cpp b/Codeforces/141A_Amusing_Joke.cpp new file mode 100644 index 0000000..b37ce8d --- /dev/null +++ b/Codeforces/141A_Amusing_Joke.cpp @@ -0,0 +1,15 @@ +//code by Nikhil Nagrale +//nikhilnagrale2 on EveryPlatform +#include +using namespace std; + +int main(){ + string a,b,c,s; + cin>>a>>b>>c; + s=a+b; + sort(s.begin(),s.end()); + sort(c.begin(),c.end()); + if(s==c) cout<<"YES"< +using namespace std; + +int main() +{ + int n; + cin >> n; + int maxindex=0; + int minindex=0; + int maxvalue=INT_MIN; + int minvalue=INT_MAX; + for (int i = 0; i < n; i++) + { + int temp; + cin >> temp; + if(temp>maxvalue){ + maxindex=i; + maxvalue=temp; + } + if(temp<=minvalue){ + minindex=i; + minvalue=temp; + } + } + + int ans=(maxindex)+(n-minindex-1); + if(minindex +using namespace std; + +int main(){ + int a[4],d; + cin>>a[0]>>a[1]>>a[2]>>a[3]>>d; + int j; + set s; + for(int i=0;i<4;i++){ + j=1; + while(a[i]*j<=d){ + if(a[i]*j<=d) s.insert(a[i]*j); + j++; + } + } + cout< +using namespace std; + +int main(){ + int n; + cin>>n; + vector v; + for(int i=0;i>temp; + v.push_back(temp); + } + int min=v[0],max=v[0],ans=0; + for(auto x:v){ + if(x>max){ + max=x; + ans++; + } + if(x +using namespace std; + +int main(){ + int n,k; + cin>>n>>k; + vector a; + for(int i=0;i>temp; + a.push_back(temp); + } + int c=a[k-1]; + int count=0; + for(int x:a){ + if(x>=c && x>0) count++; + } + cout< +using namespace std; + +int main(){ + int n; + cin>>n; + double a[n]; + double ans=0; + for(int i=0;i>a[i]; + ans+=a[i]; + } + cout< +using namespace std; + +int main() +{ + set s; + int temp; + int t = 4; + while (t--) + { + cin >> temp; + s.insert(temp); + } + cout<<4-s.size()< +using namespace std; + +int main(){ + int n; + cin>>n; + int count=0; + while(n--){ + int x,y,z; + cin>>x>>y>>z; + if((x+y+z)>=2) count++; + } + cout< +using namespace std; + +int main(){ + string s; + cin>>s; + set a; + for(char x:s) a.insert(x); + if(a.size()%2==0) cout<<"CHAT WITH HER!"< +using namespace std; + +int main(){ + int a[6][6]; + int n,x,y; + for(int i=1;i<=5;i++){ + for(int j=1;j<=5;j++){ + cin>>n; + if(n){ + x=i; + y=j; + } + } + } + cout<<(abs(3-x)+abs(3-y))<