問題一覧 > 通常問題

No.532 Possible or Impossible

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 177
作問者 : Pulmn / テスター : はむこ
お気に入りにしたユーザー ProblemId : 1625 / 自分の提出
問題文最終更新日: 2026-06-25 02:56:07
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 167 (順位表) の他の問題:

Problem Statement

You are given a natural number $N$ and a non-negative integer $M$ not exceeding $N$.
Determine whether the value $M$ can be made by using each of the $N$ numbers from $1$ to $N$ exactly $1$ time, together with the four arithmetic operations and parentheses.

<Notes on the four arithmetic operations>
・Numbers are handled within the range of rational numbers. Therefore, rational numbers may appear during the calculation.
・Division by $0$ is not allowed.
・Since each of the four arithmetic operations determines a new number from $2$ numbers, you cannot multiply by $-1$ during the calculation, as in $-(1+3)\div (-2)=2$.

Input

$N$ $M$

$1\le N\le 50,0\le M\le N$

Output

Print "Possible" if the value $M$ can be made, and "Impossible" if it cannot. Print a newline at the end.

Sample

Sample 1
Input
5 3
Output
Possible

$4\times (5\div 2-1)-3=3$

Sample 2
Input
1 0
Output
Impossible

Since $N=1$, the four arithmetic operations cannot be used. Also, note that $N$ is a natural number, whereas $M$ is a non-negative integer.

Sample 3
Input
10 1
Output
Possible

$8-9-\{(10-7+1)\div 2-4\times 5\}\div (6+3)=1$

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。