0% found this document useful (0 votes)
131 views

Python Codechef Keshav

The document summarizes the student Keshav Sharma's performance of solving various Code Chef problems for their Programming in Python lab class. It lists 14 different Code Chef problems the student solved, providing for each the problem name, link, source code submitted, and screenshot. The problems cover a range of topics including calculating total prize money, determining if a shape's area or perimeter is greater, calculating change from an ATM withdrawal, finding the number of subarrays with sum equal to product, checking if a word uses given alphabets, finding an element's position in a sorted list, checking if a number allows for jumping moves, finding longest subarray with non-zero elements, and determining if a student passes or fails based on

Uploaded by

Shivi Kapoor
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views

Python Codechef Keshav

The document summarizes the student Keshav Sharma's performance of solving various Code Chef problems for their Programming in Python lab class. It lists 14 different Code Chef problems the student solved, providing for each the problem name, link, source code submitted, and screenshot. The problems cover a range of topics including calculating total prize money, determining if a shape's area or perimeter is greater, calculating change from an ATM withdrawal, finding the number of subarrays with sum equal to product, checking if a word uses given alphabets, finding an element's position in a sorted list, checking if a number allows for jumping moves, finding longest subarray with non-zero elements, and determining if a student passes or fails based on

Uploaded by

Shivi Kapoor
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

Code Chef Problems

Student Name: Keshav Sharma UID: 21BCS9472


Branch: CSE Section/Group: 703-B
Semester: 4th Date of Performance: 22/03/23
Subject Name: Programming in Python Lab Subject Code: 21CSP-259

Name of Problem: Total Prize Money


Problem link : https://www.codechef.com/problems/PRIZEPOOL

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 :

You might also like