题解 | 小美走公路

小美走公路

https://www.nowcoder.com/practice/23a0696faab049c2b5beb480db684487

n=int(input())
road_list = list(map(int, input().split(' ')))
scr_dst = list(map(int, input().split(' ')))
scr, dst = scr_dst[0], scr_dst[1]
if scr > dst:
    tmp=scr
    scr=dst
    dst=tmp
scr2dst = sum(road_list[scr-1:dst-1])
dsr2scr = sum(road_list)-scr2dst
print(min(scr2dst, dsr2scr))

全部评论

相关推荐

迷茫的大四🐶:都让开,我tm来啦
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务