PTA 团体程序设计天梯赛练习题 python3~持续更新~

目录

L1-001

L1-002

L1-003

L1-004

L1-005

L1-007


L1-001

print("Hello World!",end="")

L1-002

import math
n,t = input().split()
n = int (n)
tmp = int(math.sqrt((n + 1)/ 2))
for i in range(tmp):
    print(' ' * i + ((tmp - i) * 2 - 1) * t)
for i in range(1,tmp):
    print(' ' * (tmp - 1 - i) + t * (i * 2 + 1))
print(n - tmp * tmp * 2 + 1,end="")

L1-003

n = list(map(int,input()))
sc = [0] * 10
tank = False
for i in n:
    sc[i] += 1
for i in range(10):
    if sc[i] != 0:
        if tank:print()
        print(i,end=":")
        print(sc[i],end="")
        tank = True

L1-004

n = int(input())
print("Celsius = ",end="")
print(int(5 * (n -32) / 9),end="")

L1-005

l = list()
for i in range(int(input())):
      l.append(input().split(' '))
input()
for i in input().split(' '):
    for j in l:
        if j[1] == i:
            print(j[0],j[2])

L1-007

dic = {'-':'fu','0': 'ling','1': 'yi','2': 'er','3': 'san','4': 'si','5': 'wu','6': 'liu','7': 'qi','8': 'ba','9': 'jiu'}
print(' '.join([dic[i] for i in list(input())]))

上一篇:L1-010 比较大小


下一篇:21合并两个有序链表