洞察如何利用第三方app跳转到微信小程序提升企业运营效率
779
2022-11-02
CodeForces 1293A——ConneR and the A.R.C. Markland-N【签到题】
题目传送门
A.R.C. Markland-N is a tall building with n floors numbered from 1 to n. Between each two adjacent floors in the building, there is a staircase connecting them.
It’s lunchtime for our sensei Colin “ConneR” Neumann Jr, and he’s planning for a location to enjoy his meal.
ConneR’s office is at floor s of the building. On each floor (including floor s, of course), there is a restaurant offering meals. However, due to renovations being in progress, k of the restaurants are currently closed, and as a result, ConneR can’t enjoy his lunch there.
CooneR wants to reach a restaurant as quickly as possible to save time. What is the minimum number of staircases he needs to walk to reach a closest currently open restaurant.
Please answer him quickly, and you might earn his praise and even enjoy the lunch with him in the elegant Neumanns’ way!
Input
Output
For each test case print a single integer — the minimum number of staircases required for ConneR to walk from the floor s to a floor with an open restaurant.
input
5 5 2 3 1 2 3 4 3 3 4 1 2 10 2 6 1 2 3 4 5 7 2 1 1 2 100 76 8 76 75 36 67 41 74 10 77
output
2 0 4 0 2 Note In the first example test case, the nearest floor with an open restaurant would be the floor 4.
In the second example test case, the floor with ConneR’s office still has an open restaurant, so Sensei won’t have to go anywhere.
In the third example test case, the closest open restaurant is on the 6-th floor.
题意
题解
AC-Code
#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~