• [F] Farmer's Pearls

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • The Farmer get a string of consecutive pearls, it contants N pearls. each pearls worth Wi. Unfortunately, the Landlord discover these pearls, the Landlord require the Farmer divide the string of pearls into M short consecutive pearls, and the Landlord will get The most expensive short consecutive pearls.

    The Farmer want to give the Landlord short consecutive pearls as cheap as possible.
  • 输入
  • This problem has several cases.
    for each case, first line have two integer N(1 <= N <= 10^6) and M (1 <= M <= N)
    the second line have N integer, it means the Wi(i = 1 ... N, 1 <= Wi <= 100).
  • 输出
  • For each case, print the least wealth of the short consecutive pearls Landlord will get.
  • 样例输入
  • 6 3
    1 2 3 2 5 4
    
  • 样例输出
  • 7
    
  • 提示
  • 来源
  • Monkeyde17
  • 操作

显示春菜