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()
文章標籤
全站熱搜