Monday, August 13, 2018

Game of Coins : Basic Programming - Implementation - Basics of Implementation

#The solution in Python3 is as follows:


ALICE = 'Alice'
BOB = 'Bob'
# Write your code here
def lolo(N):
    return ALICE
   

def init():
    T = input()
    for num_testcases in range(int(T)):
           A = int(input())
           x = lolo(A)
           print(x)
init()

#Keep visiting for more solutions of HackerEarth problems in Python 3.Thank you!!!

Sock Merchant : Algorithms - Implementation

#The solution in Python3 is as follows:


n=int(input())
a=list(map(int,input().split()))
b=set(a)
c=0
for i in b:
    if a.count(i)//2>=1:
        c+=(a.count(i)//2)
print(c)

#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!

Monday, August 6, 2018

Bon Appétit : Algorithms - Implementation

#The solution in Python3 is as follows:


n,k=map(int,input().split())
a=list(map(int,input().split()))
b=int(input())
bac=(sum(a)-a[k])//2
if bac==b:
       print("Bon Appetit")
elif bac<b:
       print(b-bac)

#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!

Drawing Book : Algorithms - Implementation

#The solution in Python3 is as follows:


n=int(input())
p=int(input())
if (n%2!=0 and p%2!=0) or (n%2!=0 and p%2==0) or (n%2==0 and p%2==0):
        print(min(p//2,(n-p)//2))
elif n%2==0 and p%2!=0:
        print(min(p//2,((n-p)//2)+1))

#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!

Wednesday, August 1, 2018

Viral Advertising : Algorithms - Implementation

#The solution in Python3 is as follows:


m = [2]
for i in range(int(input())-1):
    m.append(int(3*m[i]/2))
print(sum(m))

#Keep visiting for more solutions of HackerRank problems in Python 3.Thank you!!!