checkio的日子(2)
2013-08-30 15:55
411 查看
![](http://blog.51cto.com/attachment/201308/155509196.jpg)
def checkio(data): data[0] += data[1] data[2] -= data[3] if int(data[0]) <= int(data[2]): checkio(data) if int(data[0]) > int(data[2]): if data[0] >= data[2] + data[3]: return data[2] + data[3] else: return data[0] else: if data[0] >= data[2] + data[3]: return data[2] + data[3] else: return data[0] #Some hints #Be careful with endless loop #These "asserts" using only for self-checking and not necessary for auto-testing if __name__ == '__main__': assert checkio([150, 50, 1000, 100]) == 450, "1st example" assert checkio([150, 50, 900, 100]) == 400, "2nd example"
相关文章推荐
- checkio的日子
- checkio-Xs and Os Referee
- Python checkio Secret Message解决方案
- Python checkio median解决方案
- 遇到IOError: CRC check failed这样的问题的可能解决方法
- Python习题1:None-Unique Elements 习题+前三名答案解析(checkio.org)
- Python checkio Index Power解决方案
- Python checkio Days Between解决方案
- 03_checkio_The Most Wanted Letter
- Can not find a java.io.InputStream with the name [inputStream] in the invocation stack. Check the <
- Python checkio Transposed Matrix map与zip的使用
- apache commons io checkstyle报告(2016-04-21更新)
- Python checkio Digits Multiplication解决方案
- checkio -- Three Points Circle
- 严重: Error in dependencyCheck java.io.IOException: invalid header field(tomcat启动成功但是访问web项目404错误)
- Check iO:初学Python
- Error: java.io.IOException: Can't export data, please check failed map task logs
- Python checkio "Friends"解决方案
- CheckIO The Most Wanted Letter
- checkio-the flat dictionary