Magical BF 1 | 프로그래밍의 벗 PivotOJ
PivotOJ

Magical BF 1

시간 제한: 1000ms메모리 제한: 1024MB출처: EIO 2020-21 openBOJ 29886
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

John learned at school that in many East Asian languages texts can be written from left to right as well as from top to bottom. He got especially curious whether it's possible to write a text such that it can simultaneously be read both ways. John kept puzzling in programming class as well and now wants to write code such that it would solve the tasks when read by rows (top to bottom and left to right), as well as when read by columns (left to right and top to bottom). Naturally, he needed a suitable language for this and John chose a language called BF for experimenting.

The memory of a BF program is an infinite array MM with cells numbered from left to right (M0M_0, M1M_1, \ldots). Each cell contains a nonnegative integer that can be arbitrarily large. Additionally there is a data pointer that in the beginning of execution points to the leftmost cell (M0M_0).

The execution of a program starts from its first command and in general after the execution of each command the program moves on to the next command in the sequence. Altogether there are six commands in the language, each one denoted by one character:

Command Meaning
> Moves the data pointer to the right by one cell.
< Moves the data pointer to the left by one cell if the data pointer does not point to the leftmost cell; otherwise does nothing.
+ Increases the cell at the data pointer by one.
- Decreases the cell at the data pointer by one if the cell is currently positive; otherwise does nothing.
[ If the cell at the data pointer is zero, then jumps forward to the corresponding ']' symbol; otherwise does nothing.
] If the cell at the data pointer is nonzero, then jumps back to the corresponding '[' symbol; otherwise does nothing.

Help John write magical BF programs for solving the five tasks listed below.

As a solution to each task submit an N×NN \times N grid of BF program code (where 1N10001 \le N \le 1000). The code does not have to be the same when read by rows and by columns, but must solve the task correctly in both cases. The solution text can only contain the characters '>', '<', '+', '-', '[' and ']' and must completely fill the grid. For any allowed input, the code must not execute more than 1010 million commands.

Task: The cells M0M_0 and M1M_1 of the array contain the integers xx and yy (0yx2000 \le y \le x \le 200), all other cells contain zeros. Write the difference xyx-y into the cell M0M_0.

Input example: [이미지 1]

Output example: [이미지 2]

In the output, it only matters that the cell M0M_0 contains the difference of xx and yy (in this case, 75=27 - 5 = 2), other cells may contain any numbers (for example, 15001500, 00, 4242, \ldots).

이 문제는 채점 준비 중입니다. 테스트 데이터가 확보되면 제출이 가능합니다.