Open Kattis Problems’ Solutions in Python


Problem: ABC

Problem Link: https://open.kattis.com/problems/abc

Sample Solution:

array=list(map(int,input().split()))
ar_sorted =  sorted(array, key=int)
string = input()
if string == 'ABC':
    print(ar_sorted)

 

Problem: Apaxiaaaaaaaaaaaans

Problem Link: https://open.kattis.com/problems/apaxiaaans

Sample Solution:

oldstring = input()
newstring = oldstring[0]
for char in oldstring[1:]:
    if char != newstring[-1]:
        newstring += char
print(newstring)

 

Problem: Modulo

Problem Link: https://open.kattis.com/problems/modulo

Sampe Solution:

a = []
b = 0
for i in range(10):
    mod = a[i][0] % 42 
    if mod != a[i+1][0] % 42:
        b+=1
print(b)

 

Problem: Number Fun

Problem Link: https://open.kattis.com/problems/numberfun

Sample Solution:

def arith(a, b, c):
    if a+b==c or a*b==c or a-b==c or b-a==c or a/b==c or b/a == c:
        print("possible")
    else:
        print("impossible")
a = []
n = int(input()) 
for i in range(n):
    a.append([int(j) for j in input().split()])

for i in range(n):
    print(a[i][0], a[i][1], a[i][2])
    

 

Sonam Dargay

Kuzu Zangpo la! I am Sonam Dargay, a student in the College of Science and Technology affiliated to The Royal University of Bhutan. I am a tech enthusiast student, studying Bachelor of Engineering in Information Technology.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: