Submeter | Todas submissőes | Melhores | Voltar |
Problem hidden
BLOPER - Operators |
Given a set of N integer A = {1, 2, 3, …, N} and a integer S, your task is find a way to insert an operator ‘+’ or ‘-‘ to every neighbor pair of A, that the result of the expression after insert equal to S.
Input
A single line, N and S (1 ≤ N ≤ 500, |S| ≤ 125250)
Output
If there are way(s) to insert, outputs any of them, otherwise outputs “Impossible” (without quotes).
Example
Input: 9 5 Output: 1-2+3-4+5-6+7-8+9
Input: 5 6 Output: Impossible
Adicionado por: | Kata |
Data: | 2014-03-28 |
Tempo limite: | 0.100s |
Tamanho do fonte: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Linguagem permitida: | Todas exceto: ASM64 CLOJURE ERL FSHARP PERL6 PY_NBC SCALA TCL |