close

題目大意:  就輸入輸出。

思路:  爛judge又在欺負C++了,這邊用python AC。C++輸入怪怪的一直WA。就一個index一直向右移動。

遇到沒出現就把index重製。

代碼: 

import sys
def solve():
    i = 0
    lt = ["Hi", "Hello", "How do you do", "How are you"]
    for line in sys.stdin:
        s = line.rstrip()
        if s == 'Bye':
            print('Bye')
            i = 0
            continue
        if s not in lt:
            print('Sorry')
            i = 0
            continue
        print(lt[i])
        i += 1
        i %= 4

if __name__ == "__main__":
    solve()

arrow
arrow
    創作者介紹
    創作者 尾玉 的頭像
    尾玉

    louisfghbvc的部落格

    尾玉 發表在 痞客邦 留言(0) 人氣()