#20525: 為什麼NA(98%)?第61和89個側資點不會過


youngyoung (youngyoung)

School : 臺北市私立延平高級中學
ID : 98924
IP address : [111.235.252.96]
Last Login :
2021-04-30 11:49:39
e623. 2. PPAP -- 2019年10月TOI練習賽新手組 | From: [180.217.184.41] | Post Date : 2020-02-03 13:31

InputNumber = eval(input())
WhichOneInTheLine = InputNumber % 4 if InputNumber % 4 != 0 else 4
def HowManyCompleteLevels(GivenNumber):
    i = 1
    while (i + 2) * (i + 1) / 2< GivenNumber:
        i += 1
    return i

def HowManyNumbersInCompleteLevels():
    return (HowManyCompleteLevels(InputNumber / 4) + 1) * HowManyCompleteLevels(InputNumber / 4) / 2

def HowManyLinesLeft():
    return int(InputNumber // 4 - HowManyNumbersInCompleteLevels() + 1) if WhichOneInTheLine != 4 else int(InputNumber // 4 - HowManyNumbersInCompleteLevels())

def WhatFruitItIs(GetNumber):
    if GetNumber * 4 - HowManyCompleteLevels(InputNumber / 4) <= 1:
        return "Pen"
    elif GetNumber * 4 - 2 * HowManyCompleteLevels(InputNumber / 4) <= 2:
        return "Pineapple"
    elif GetNumber * 4 - 3 * HowManyCompleteLevels(InputNumber / 4) <= 3:
        return "Apple"
    else:
        return "Pineapple pen"

def main():
        print(WhatFruitItIs(HowManyLinesLeft()))
main()
 
ZeroJudge Forum