当前位置: 代码迷 >> 综合 >> 洛谷 P3137 [USACO16FEB]圆形谷仓Circular Barn
  详细解决方案

洛谷 P3137 [USACO16FEB]圆形谷仓Circular Barn

热度:78   发布时间:2023-12-13 18:48:03.0

题目描述
Being a fan of contemporary architecture, Farmer John has built a new barn in the shape of a perfect circle. Inside, the barn consists of a ring of rooms, numbered clockwise from around the perimeter of the barn (). Each room has doors to its two neighboring rooms, and also a door opening to the exterior of the barn.
Farmer John owns cows, and he wants exactly one cow to end up in each room in the barn. However, the cows, being slightly confused, line up at haphazard doors, with possibly multiple cows lining up at the same door. Precisely cows line up outside the door to room , so .
To manage the process of herding the cows so that one cow ends up in each room, Farmer John wants to use the following approach: each cow enters at the door at which she initially lined up, then walks clockwise through the rooms until she reaches a suitable destination. Given that a cow walking through doors
consumes energy, please determine the minimum amount of energy n

  相关解决方案