PTA 乙级 1021 个位数统计 (15分) Python

 Python

看见这个题就想起来1017了,于是就用了python

1 n = input()
2 num = [0,0,0,0,0,0,0,0,0,0]
3 for i in range(10):
4     num[i] = n.count(str(i))
5 for i in range(10):
6     if(num[i] != 0):
7         print("{}:{}".format(i,num[i]))

 水水水!

原文地址:https://www.cnblogs.com/SCP-514/p/13263718.html