当前位置: 代码迷 >> 综合 >> CodeForces 1015D
  详细解决方案

CodeForces 1015D

热度:1   发布时间:2024-01-19 07:55:58.0
题目链接 CodeForces 1015D  

There are n houses in a row. They are numbered from 1 to n in order from left to right. Initially you are in the house 1.

You have to perform k moves to other house. In one move you go from your current house to some other house. You can't stay where you are (i.e., in each move the new house differs from the current house). If you go from the house x to the house y, the total distance you walked increases by |x?y| units of distance, where |a| is the absolute value of a. It is possible to visit the same house multiple times (but you can't visit the same house in sequence).

Your goal is to walk exactly sunits of distance in total.

If it is impossible, print "NO". Otherwise print "YES" and any of the ways

  相关解决方案