Masala #PM4JCA1KKP
Staklash #2
Menimcha siz “Staklash 1” masalasini yechib bo'ldingiz. Endi buni murakkabroq variantini yechib ko'ring. Siz faqat uni “|S|S|S|S|S|S|X|”(S-to'liq stak, X-ortib qolgan stak) ko'rinishida chiqarishingiz kerak!
Kirish faylida siz ga yana 1 ta N - LOG soni kiritiladi.
Chiqish faylida siz WOOD larni “|S|S|S|S|S|S|X|”(S-to'liq stak, X-ortib qolgan stak) ko'rinishida chop eting!
# | input.txt | output.txt |
---|---|---|
1 |
20 |
|64|16| |
2 |
51 |
|64|64|64|12| |
3 |
254 |
|64|64|64|64|64|64|64|64|64|64|64|64|64|64|64|56| |
For kerak bo'lishi mumkin!