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


youngyoung (06 蘇昱揚 306)

學校 : 臺北市私立延平高級中學
編號 : 98924
來源 : [180.217.13.133]
最後登入時間 :
2022-05-03 14:31:59
e623. 2. PPAP -- 2019年10月TOI練習賽新手組 | From: [180.217.184.41] | 發表日期 : 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