您当前的位置: 首页 > 

钟钟终

暂无认证

  • 1浏览

    0关注

    233博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

第二周--贪心题解(O)

钟钟终 发布时间:2021-03-14 23:39:28 ,浏览量:1

题O:

Given a sequence with N integers A(1), A(2), …, A(N), your task is to find out a sequence B(1), B(2), …, B(N), such that V = (|A(1) – B(1)| + |A(2) – B(2)| + … + |A(N) – B(N)|) + (|B(1) – B(2)| + |B(2) – B(3)| + … +|B(N-1) – B(N)|)

is minimum. Input The first line in the input contains an integer N (1

关注
打赏
1664378814
查看更多评论
立即登录/注册

微信扫码登录

0.0373s