SRM144 DIV2 200

一般编程题

 1 class Time:
 2     def whatTime(self, seconds):
 3         h = seconds // 3600
 4         m = seconds % 3600 // 60
 5         s = seconds % 60
 6         return "%s:%s:%s" % (h, m, s)
 7 
 8 # test
 9 o = Time()
10 
11 # test case
12 assert(o.whatTime(0) == "0:0:0")
13 assert(o.whatTime(3661) == "1:1:1")
14 assert(o.whatTime(5436) == "1:30:36")
15 assert(o.whatTime(86399) == "23:59:59")
16 print('ok')
View Code
原文地址:https://www.cnblogs.com/valaxy/p/3440803.html