paiza Online Hackathon Vol.8 (POH8) with Python3

ショートヘア

RepeatNum = int(input())
OutputString = input()

for C in range(RepeatNum):
    print(OutputString)

ロングヘア

Integer = int(input())

Answer = "lucky" if Integer % 7 == 0 else "unlucky"
print(Answer)

ポニーテール

CorrectAnserQuant = 0
for n in range(5):
    dn,en = input().split()
    if dn == en:
        CorrectAnserQuant += 1

Answer = "OK" if CorrectAnserQuant >= 3 else "NG"
print(Answer)

ツインテール

TotalLength = int(input())
CurrentStatusNum = int(input())

CharList = ["-" for C in range(TotalLength)]
CurrentIndex = CurrentStatusNum - 1
CharList[CurrentIndex] = "+"
Answer = "".join(CharList)
print(Answer)

おさげ

def Check(MaxLength,MaxSongQuant):
    SongQuant,TotalLength = 0,0
    for n in range(MaxSongQuant):
        SongLength = int(input())
        TotalLength += SongLength
        if TotalLength > MaxLength:
            return(SongQuant)
        SongQuant += 1
    return("OK")

MaxLength = int(input())*60
MaxSongQuant = int(input())

Answer = Check(MaxLength,MaxSongQuant)
print(Answer)

たれ目

RemainSeatsQuant,PeopleQuant = map(int,input().split())

Answer = "OK" if RemainSeatQuant >= PeopleQuant else "NG"
print(Answer)

つり目

p = int(input()) #買物額

Answer = p//100 if p < 1000 else p//100 + 10
print(Answer)

めがね

N = int(input()) #数字の個数
NumSequence = [i for i in map(int,input().split())].sort(reverse=True)

CenterIndex = (N+1)//2 -1
Answer = NumSequence[CenterIndex]
print(Answer)

Cute衣装

#スタッフの人数、パックに入っているアメ玉の数
n,m = map(int,input().split())

Answer = "ok" if m % n == 0 else "ng"
print(Answer)

Sexy衣装

#元の位置から進んだ歩数, 進んだ先から下がった歩数
M,N = map(int,input().split())

CP = M - N #CurrentPosition
Answer = CP if CP > 0 else 0
print(Answer)

制服

CardSequence = ["3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A", "2"]
OrderSequence = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
PlayerRankList = [0 for C in range(52)]
PlayerHandList = [OrderSequence[CardSequence.index(Card)] for Card in input().split()]

HighestCardNum,LastPlayerIndex = 0,52
while PlayerHandList.count(0) != 52:
    for Index,CardNum in enumerate(PlayerHandList):
        if LastPlayerIndex == Index:
            HighestCardNum = 0
        elif CardNum > HighestCardNum:
            HighestCardNum = CardNum
            LastPlayerIndex = Index
            PlayerHandList[Index] = 0
            PlayerRankList[Index] = max(PlayerRankList) + 1

for i in rank:
    print(i)

浴衣

N = int(input()) #冷蔵庫からの出し入れの回数

eue2 = 0 #electric utility expense
temp = 0 #temperature
lasttime = 0
for i in range(N):
    ti,si = input().split()
    up = 5 if si == "in" else 3
    tdiff = int(ti) - lasttime
    eue2 += up
    temp += up - tdiff if temp - tdiff >= 0 else up - temp
    lasttime = int(ti)
temp -= 24 - lasttime

answer = 24-eue2 + 2*eue2 if temp <= 0 else 24-eue2 + 2*eue2 - temp
print(answer)

水着

#変更前の文字列の長さ、変更後の文字列の長さ
n,m = map(int,input().split())

s = input() #変更前の文字列
t = input() #変更後の文字列

counter = {}
for c in s:
    if not c in counter:
        counter[c] = 1
    else:
        counter[c] += 1
for c in t:
    if not c in counter:
        counter[c] = -1
    else:
        counter[c] -= 1

answer = sum(-1*i for i in counter.values() if i < 0)
print(answer)

マイク

import math

n = int(input()) #1日にこなせるイベント回数
m = int(input()) #計画されているイベント総回数

answer = math.ceil(m/(n*2))
print(answer)

カチューシャ

import math

#ファンの人数(人) 、色紙1枚の費用(円)
n,p = map(int,input().split())
#ペン1本でサインの書ける色紙枚数(枚)、ペン1本の費用(円)
m,q = map(int,input().split())

answer = math.ceil(n/m)*q + n*p
print(answer)