Python Codechef Keshav
Python Codechef Keshav
Source Code:
t=int(input())
while t :
inp = input().split()
x = int(inp[0])
y = int(inp[1])
print(x*10+y*90)
t-=1
ScreenShot :
Name of Problem: Area or Perimeter
Problem link : https://www.codechef.com/problems/AREAPERI
Source Code:
Length = int(input())
Breadth = int(input())
Area = Length *Breadth
perimeter = 2 * (Length+Breadth)
if perimeter > Area:
print("Peri")
print(perimeter)
elif perimeter < Area:
print("Area")
print(Area)
else:
print("Eq")
print(Area)
ScreenShot :
Name of Problem: ATM
Problem link : https://www.codechef.com/problems/HS08TEST
Source Code:
n,atm=map(float,input().split())
n=int(n)
if (n+0.5<=atm and n%5==0):
print(float(atm-n-0.5))
else:
print(float(atm))
ScreenShot :
Name of Problem: Chef and Subarrays
Problem link : https://www.codechef.com/problems/CHEFARRP
Source Code:
for i in range(int(input())):
b=int(input())
l=list(map(int,input().split()))
c=0
for j in range(b):
p=1
s=0
for j in range(j,b):
s=s+l[j]
p=p*l[j]
if (s==p):
c=c+1
print(c)
ScreenShot :
Name of Problem: Studying Alphabets
Problem link : https://www.codechef.com/problems/ALPHABET
Source Code:
s=input()
n=int(input())
for i in range(n):
w=input()
if(w.strip(s)==''):
print("Yes")
else:
print("No")
ScreenShot :
Name of Problem: Uncle Johny
Problem link : https://www.codechef.com/problems/JOHNY
Source Code:
for i in range(int(input())):
n=int(input())
l=list(map(int,input().strip().split()))
k=int(input())
p=l[k-1]
l.sort()
print(l.index(p)+1)
ScreenShot :
Name of Problem: Chef-Jumping
Problem link : https://www.codechef.com/problems/OJUMPS
Source Code:
n=int(input())
if n%3==0 or n%6==1:
print("yes")
else:
print("no")
ScreenShot :
Name of Problem: Chef and Subarray
Problem link : https://www.codechef.com/problems/CHEFZOT
Source Code:
x=int(input())
a=list(map(int,input().split()))
a.append(0)
count=0
arr=[]
for i in a:
if i !=0:
count+=1
elif(i==0):
arr.append(count)
count=0
print(max(arr))
ScreenShot :
Name of Problem: Pass or Fail
Problem link : https://www.codechef.com/problems/PASSORFAIL
Source Code:
t=int(input())
for i in range(t):
n,x,p=map(int,input().split())
if 4*x-n>=p:
print('Pass')
else:
print('Fail')
ScreenShot :
Name of Problem: Summer Heat
Problem link : https://www.codechef.com/problems/COCONUT
Source Code:
T=int(input())
for i in range(T):
a,b,c,d = map(int,input().split())
gas = int(c/a)
has = int(d/b)
print(gas+has)
ScreenShot :