n+2
Попробуйте онлайн! Объяснение:
GH+→⁺²θ⁺ ×θ#
Преобразовать в унарный.
n
Повторите строку Fθ
n
с Nθ
times.
NθFθGH+→⁺²θ⁺ ×θ#
Префикс строки ' #'[(v,0)∘.≠((n×n+1)⍴v←0,(n←⎕)⍴1),0]
main(i,j,n){
scanf("%d",&n);
++n;
for(i=-1;i++<n;puts(""))
for(j=-1;j++<n*n-n;
putchar("# "[!(j%n)^(i^n&&i)]));
}
s с суффиксом main(i,j,n){scanf("%d",&n);++n;for(i=-1;i++<n;puts(""))for(j=-1;j++<n*n-n;putchar("# "[!(j%n)^(i^n&&i)]));}
. This indicates the pattern for the first line.
i=-1,j;main(n){for(n+=scanf("%d",&n);j=i++<n;puts(""))for(;j-->n-n*n;putchar("# "[!(j%n)^(i^n&&i)]));}
Добавьте еще одну такую строку.
param($n)($t=(' '+'#'*$n)*$n);,(('#'+' '*$n)*$n+'#')*$n;$t
Добавить f: push rsi # Push n onto the stack.
sl: .byte 0xB8, 0x20, 0x0A # These bytes combine with the next instruction to form
# mov eax, 0x23B00A20. In particular, the lowest byte (AL) is 0x20 (' ')
# and the second-lowest byte (AH) is 0x0A ('\n').
pl: mov al, 0x23 # (Executed for the middle lines) Set AL to 0x23 ('#').
pop rdx; push rdx # Set RDX to n. (This is 2 bytes; mov edx, [rsp] would be 3.)
l: stosb # Write AL to the string, advancing the pointer.
xor al, 3 # Change AL from ' ' to '#' or vice versa.
pop rcx; push rcx # Set RCX to n.
rep stosb # Write AL to the string RCX times, advancing the pointer.
xor al, 3 # Change AL from ' ' to '#' or vice versa.
dec edx # Subtract 1 from EDX.
jnz l # If it's not zero, jump back. (Repeats n times.)
stosw # Write AL and AH ('\n') to the string, advancing the pointer.
dec esi # Subtract 1 from ESI.
jns pl # If it's not negative (which occurs n times),
# jump back to make a line starting with '#'.
jpe sl # Jump back to make a line starting with ' '
# if the sum of the eight low bits is even.
# This is true for -1 (…11111111) but not for -2 (…11111110).
mov [rdi], dl # Add DL (the low byte of RDX), which is 0, to the string.
pop rcx # Take n off the stack.
ret # Return.
to the original 56 B8 20 0A B0 23 5A 52 AA 34 03 59 51 F3 AA 34 03 FF CA 75 F3 66 AB FF CE 79 E9 7A E4 88 17 59 C3
линии. Они указывают шаблон для промежуточных линий.
'# '# Push "#"
ú # Pad it with the (implicit) input amount of leading spaces
R # Reverse it so the spaces are trailing
× # Repeat this the (implicit) input amount of times as string
Ć # Enclose; append its own head (the "#")
и # Repeat it the (implicit) input amount of times as list
¬ # Push its first item (without popping the list)
D # Duplicate it
Ù # Uniquify its characters: "# "
 # Bifurcate; short for Duplicate & Reverse copy: " #"
‡ # Transliterate all "# " to " #" in the duplicated string
.ø # Surround the list with this string as leading/trailing item
» # Join by newlines
# (after which the result is output implicitly)
Примените остальную часть сценария отдельно к каждой строке.
'#úR×Ćи¬DÙ‡.ø»
Повторяем каждую строку f n=unlines[[" # "!!(0^mod x(n+1)+0^y)|x<-[0..n*n+n]]|y<-[0..n]++[0]]
times. This also leaves an extra copy of the two pattern characters on a line on its own.
" #"⊏˜·≠⌜´+⟜1(+⥊↑⟜1)¨1∾ט
Замените каждый ->n{[z=(" "+?#*n)*n,[?#+(" "*n+?#)*n]*n,z]*$/}
with the last character on the line.
v\#*Ṅðp…£v\#?꘍*Ǐ¥J
Удалить последний символ в каждой строке, поскольку он соединяется со следующей строкой.
joe
Переместите последнюю копию первого символа шаблона в начало всей строки и удалите последнюю копию второго символа шаблона.