盒饭
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
有 n 个饭盒放成一排,其中第 m 个饭盒里多了一块牛肉。鲁观特别想吃带牛肉的那盒饭,但食堂阿姨说他只能先打开第一个饭盒,然后再向前移动两个饭盒,再向前移动三个饭盒,依此类推。当到达最后一个饭盒的时候,再回到第一个饭盒继续寻找,一共只允许找2 * m次。请你帮鲁观判断下是否能找到带牛肉的饭盒。
Input
第一行饭盒数n,第二行有牛肉的饭盒m
(0 < n < 1000, 0 <= m < n)
Output
如果能吃到,输出"Y",如果不能吃到,输出"N"
Samples
5
3
Y
Hint
初始状态为第0个饭盒。 对于样例,一开始位置在第0个饭盒,第一次访问第1个饭盒,第二次访问第3个饭盒,可以找到。
2025_SDNU_国庆纳新题单
- Status
- Done
- Rule
- ACM/ICPC
- Problem
- 20
- Start at
- 2025-9-30 14:30
- End at
- 2025-10-8 22:30
- Duration
- 200 hour(s)
- Host
- Partic.
- 22