2018-11-25-python-ACM输入输出格式

2018-11-26  本文已影响0人  termanary

上次不小心挂在了大数题上,遂决意学习python应对之(java学不会,而且python更简单):
python输入:

#!/usr/bin/python3

while True :
    try :
        a = input().strip().split()
    except EOFError:
        break

    # Judge NULL list :
    if len(a)==0 :
        break

    # Program :
    # a = list(map(lambda x:int(x),a))
    # input example :
    # 0  1  2  3  4  5  6  7  8  9  

    # Program :
    # x,y,z,w = int(a[0]),float(a[1]),str(a[2]),int(a[3])
    # input example :
    # 0  1.2  a34  5

    # Program :
    i = 0
    e = []
    f = []
    while i < int(a[0]) :
        e.append(float(a[i*2+1]))
        f.append(str(a[i*2+2]))
        i += 1
    # input example :
    # 3  1  aa  2  bb  3  cc

# # Comment :

# # delete the space in the begin and the end :
# input().strip()

# # string replace :
# str.replace('source','target')

# # almbda function :
# f = lambda x,y : x + y
# print( f(9,8) )

# # the different between python2 and python3 :
# python2 : a = map()
# python3 : a = list(map())

# # convert type :
# chr() str() int() float()



python输出:

print(a,b,end=" ")

PS:真心不喜欢python,做什么都要查API,还是喜欢C。

上一篇 下一篇

猜你喜欢

热点阅读