This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.codechef.com/LRNDSA01/problems/MULTHREE | |
def check_multiple_of_three(k, d0, d1): | |
if k == 2: | |
return not ((d0 + d1) % 3) | |
sum_of_digits = d0 + d1 + ((d0 + d1) % 10) | |
if k > 3: | |
a = ((d0 + d1) << 1) % 10 | |
b = ((d0 + d1) << 2) % 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cook yur dish here | |
# https://www.codechef.com/LRNDSA01/problems/LADDU | |
def LADDU_ACCURAL_SYSTEM(activity): | |
if activity[0] == 'CONTEST_WON': | |
return 300 + ((20 - int(activity[1])) if int(activity[1])<20 else 0) | |
if activity[0] == 'TOP_CONTRIBUTOR': | |
return 300 | |
if activity[0] == 'BUG_FOUND': | |
return int(activity[1]) | |
if activity[0] == 'CONTEST_HOSTED': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.codechef.com/LRNDSA01/problems/CONFLIP | |
import math | |
def main(): | |
for _ in range(int(input())): | |
for _ in range(int(input())): | |
I,N,Q = map(int, input().split()) | |
if I == Q: | |
print(math.floor(N/2)) | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.codechef.com/LRNDSA01/problems/FCTRL | |
def solution(a): | |
if a < 5: | |
return 0 | |
else: | |
b = a // 5 | |
return b + solution(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.codechef.com/problems/CARVANS | |
def main(): | |
for T in range(int(input())): | |
num_cars = int(input()) | |
speed = map(lambda x: int(x) , input().split()) | |
count = 0 | |
max_speed = float('inf') | |
for i in speed: | |
if i < max_speed: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.codechef.com/LRNDSA01/problems/ZCO14003/""" | |
def main(): | |
num_customer = int(input()) | |
bgt_lst = sorted([int(input()) for i in range(num_customer)],reverse=True) | |
revenue = max([(index+1)*value for index,value in enumerate(bgt_lst)]) | |
print(revenue) | |
if __name__ == '__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.codechef.com/LRNDSA01/problems/LAPIN""" | |
def LRNDSA01(ip,first_end,second_start,strlen): | |
d = dict() | |
for i in range(first_end): | |
d[ip[i]] = d.get(ip[i],0)+1 | |
for j in range(second_start,strlen): | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.codechef.com/LRNDSA01/problems/FLOW007""" | |
def main(): | |
n=int(input()) | |
while(n!=0): | |
print(int(input()[::-1])) | |
n-=1 | |
if __name__ == '__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""https://www.codechef.com/LRNDSA01/problems/TEST""" | |
def main(): | |
"""if input is 42 than stop the processing""""" | |
x = int(input().strip()) | |
while x != 42 : | |
print(x) | |
x = int(input().strip()) | |
if __name__ == '__main__': |