ACM模式OJ或者筆試
每個例子:第一行是整數,表示長度
第二行是多個整數
'''
Input()打印提示字符串(如果給定)到標准輸出,並從標准輸入中讀取字符串,尾部換行符被剝離。如果用戶輸入EOF,會觸發EOFError。
請注意,Python3中input()一次讀取一行,並當作字符串,與Python2中的raw_input()相同
Python的輸入是野生字符串,所以要自己轉類型
strip去掉首尾的空格和換行符(默認時),返回str
slipt把字符串按空格拆開(默認時),返回[str]
map把list里面的值映射到指定類型,返回[type]'''
while True:
try:
# length = list(map(int, input().strip().split())) # 不要忘記最外邊的 list() 否則是個map對象
# length = length[0]
length = int(input()) # 一個數字可以這樣
except EOFError:
break
nums = list(map(int, input().strip().split()))
print(length)
參考:
https://www.cnblogs.com/lfri/p/10373431.html
https://blog.csdn.net/Fire_to_cheat_/article/details/89070451
https://www.codeleading.com/article/53955599915/
Python map()函數將一個全部為int的列表,轉化為全部為str的列表