From 12621cac6903429eda28e4b26528ba0180e4a199 Mon Sep 17 00:00:00 2001 From: Arvind Date: Thu, 1 Oct 2020 21:44:42 +0530 Subject: [PATCH 1/2] Added some more solutions Added the solution of some cdechef problems. --- 33271144.py | 3 +++ Ada King- July20B.py | 14 ++++++++++++++ Another_Card(Aug20B).py | 9 +++++++++ Carvans.py | 11 +++++++++++ Chef and Cards- July20B.py | 25 +++++++++++++++++++++++++ Chef and Strings- July20B.py | 7 +++++++ 6 files changed, 69 insertions(+) create mode 100644 33271144.py create mode 100644 Ada King- July20B.py create mode 100644 Another_Card(Aug20B).py create mode 100644 Carvans.py create mode 100644 Chef and Cards- July20B.py create mode 100644 Chef and Strings- July20B.py diff --git a/33271144.py b/33271144.py new file mode 100644 index 0000000..fc8bb79 --- /dev/null +++ b/33271144.py @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/Ada King- July20B.py b/Ada King- July20B.py new file mode 100644 index 0000000..c18a301 --- /dev/null +++ b/Ada King- July20B.py @@ -0,0 +1,14 @@ +for _ in range(int(input())): + temp = ["O"] + for __ in range(int(input())): + temp.append(".") + temp+= ["X"]*(64-len(temp)) + chess,k =[], 0 + for i in range(8): + temp2=[] + for j in range(8): + temp2.append(temp[k]) + k+=1 + chess.append(temp2) + print('\n'.join([''.join([item for item in row]) + for row in chess]),"\n") diff --git a/Another_Card(Aug20B).py b/Another_Card(Aug20B).py new file mode 100644 index 0000000..7d3f935 --- /dev/null +++ b/Another_Card(Aug20B).py @@ -0,0 +1,9 @@ +import math +for _ in range(int(input())): + Pc,Pr = map(int, input().split()) + Pr = math.ceil(Pr/9) + Pc = math.ceil(Pc/9) + if Pr <= Pc: + print(1,Pr) + else: + print(0,Pc) diff --git a/Carvans.py b/Carvans.py new file mode 100644 index 0000000..0fe4d96 --- /dev/null +++ b/Carvans.py @@ -0,0 +1,11 @@ + +for _ in range(int(input())): + x=int(input()) + y=list(map(int,input().split())) + max=0 + for i in range(x-1): + if y[i+1]>y[i]: + y[i+1]=y[i] + else: + max+=1 + print(max) diff --git a/Chef and Cards- July20B.py b/Chef and Cards- July20B.py new file mode 100644 index 0000000..3ba520c --- /dev/null +++ b/Chef and Cards- July20B.py @@ -0,0 +1,25 @@ +def count(i): + c = 0 + for __ in range(len(i)): + c+=int(i[__]) + return c + + +for _ in range(int(input())): + chef= 0 + morty= 0 + for k in range(int(input())): + a,b = input().split() + if count(a)>count(b): + chef+=1 + elif count(a) morty: + print(0, chef) + elif chef < morty: + print(1, morty) + else: + print(2, chef) \ No newline at end of file diff --git a/Chef and Strings- July20B.py b/Chef and Strings- July20B.py new file mode 100644 index 0000000..84d8a68 --- /dev/null +++ b/Chef and Strings- July20B.py @@ -0,0 +1,7 @@ +for _ in range(int(input())): + n=int(input()) + lis= list(map(int,input().split())) + skip_strings=0 + for i in range(n-1): + skip_strings+= lis[i+1] -lis[i] -1 + print(skip_strings) From eb9dcdf4a1d9f70668cbf909ed186991c05264a8 Mon Sep 17 00:00:00 2001 From: Arvind Date: Thu, 1 Oct 2020 21:45:40 +0530 Subject: [PATCH 2/2] Added solutions Added few more solutions. --- Life,The Universe And Everything.py | 4 ++++ lapindrome.py | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 Life,The Universe And Everything.py create mode 100644 lapindrome.py diff --git a/Life,The Universe And Everything.py b/Life,The Universe And Everything.py new file mode 100644 index 0000000..1462bf1 --- /dev/null +++ b/Life,The Universe And Everything.py @@ -0,0 +1,4 @@ +i=int(input()) +while i!=42: + print(i) + i=int(input()) diff --git a/lapindrome.py b/lapindrome.py new file mode 100644 index 0000000..77fecc7 --- /dev/null +++ b/lapindrome.py @@ -0,0 +1,12 @@ +z=int(input()) +for i in range(z): + s=input() + s1=s[:len(s)//2] + s2=s[(len(s)+1)//2:] + try: + for i in s1: + t=s2.index(i) + s2=s2[:t]+s2[t+1:] + print("YES") + except ValueError: + print("NO") \ No newline at end of file