No.2655 Increasing Strides
問題文最終更新日: 2024-02-29 21:21:51
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 419
(順位表)
の他の問題:
Problem Statement
You are standing on a $2$-dimensional plane.
Given a positive integer $N$, determine whether you can return to your original position by making the following $N$ moves.
- In the $i$-th move $(i=1,2,\cdots,N)$, you go straight for $i$ meters
- The directions of travel of the $i$-th and $i+1$-th moves $(i=1,2,\cdots,N-1)$ differ by $90$ degrees
Constraints
- $N$ is an integer
- $1 \le N \le 10^5$
Input
The input is given from Standard Input in the following format.$N$
Output
Print Yes if you can return to your original position, and No if you cannot.
Print a newline at the end.
Sample
Sample 1
Input
2
Output
No
- Move $1$: go $1$ meters
- Move $2$: go $2$ meters in a direction differing by $90$ degrees from move $1$
You cannot return to your original position with these $2$ moves.
Sample 2
Input
4
Output
No
- Move $1$: go $1$ meters
- Move $2$: go $2$ meters in a direction differing by $90$ degrees from move $1$
- Move $3$: go $3$ meters in a direction differing by $90$ degrees from move $2$
- Move $4$: go $4$ meters in a direction differing by $90$ degrees from move $3$
You cannot return to your original position with these $4$ moves.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
hamamu
てんぷら