Module module1
Sub main()
Dim d As Integer() = {1, 2, 3, 4}
narabe(d, d.Length, d.Length)
End Sub
Sub kekka_shori(ByRef d As Integer(), len As Integer)
Dim i As Integer
Dim arr(len - 1) As Integer
i = 0
While (i < len)
Console.Write(d(i))
i += 1
End While
Console.WriteLine()
End Sub
Sub narabe(ByRef d As Integer(), len As Integer, n As Integer)
Dim i, j As Integer
Dim tmp As Integer
If n <= 1 Then
kekka_shori(d, len)
Return
End If
For j = 0 To n - 1
narabe(d, len, n - 1)
tmp = d(len - n)
For i = 0 To n - 2
d(len - n + i) = d(len - n + i + 1)
Next
d(len - n + i) = tmp
Next
End Sub
End Module
Ck1vZHVsZSBtb2R1bGUxCiAgICBTdWIgbWFpbigpCgogICAgICAgIERpbSBkIEFzIEludGVnZXIoKSA9IHsxLCAyLCAzLCA0fQogICAgICAgIG5hcmFiZShkLCBkLkxlbmd0aCwgZC5MZW5ndGgpCiAgICBFbmQgU3ViCgoKICAgIFN1YiBrZWtrYV9zaG9yaShCeVJlZiBkIEFzIEludGVnZXIoKSwgbGVuIEFzIEludGVnZXIpCiAgICAgICAgRGltIGkgQXMgSW50ZWdlcgogICAgICAgIERpbSBhcnIobGVuIC0gMSkgQXMgSW50ZWdlcgoKICAgICAgICBpID0gMAogICAgICAgIFdoaWxlIChpIDwgbGVuKQogICAgICAgICAgICBDb25zb2xlLldyaXRlKGQoaSkpCiAgICAgICAgICAgIGkgKz0gMQogICAgICAgIEVuZCBXaGlsZQogICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCkKICAgIEVuZCBTdWIKCgogICAgU3ViIG5hcmFiZShCeVJlZiBkIEFzIEludGVnZXIoKSwgbGVuIEFzIEludGVnZXIsIG4gQXMgSW50ZWdlcikKCiAgICAgICAgRGltIGksIGogQXMgSW50ZWdlcgogICAgICAgIERpbSB0bXAgQXMgSW50ZWdlcgoKICAgICAgICBJZiBuIDw9IDEgVGhlbgogICAgICAgICAgICBrZWtrYV9zaG9yaShkLCBsZW4pCiAgICAgICAgICAgIFJldHVybgogICAgICAgIEVuZCBJZgoKICAgICAgICBGb3IgaiA9IDAgVG8gbiAtIDEKICAgICAgICAgICAgbmFyYWJlKGQsIGxlbiwgbiAtIDEpCiAgICAgICAgICAgIHRtcCA9IGQobGVuIC0gbikKCgogICAgICAgICAgICBGb3IgaSA9IDAgVG8gbiAtIDIKICAgICAgICAgICAgICAgIGQobGVuIC0gbiArIGkpID0gZChsZW4gLSBuICsgaSArIDEpCgogICAgICAgICAgICBOZXh0CiAgICAgICAgICAgIGQobGVuIC0gbiArIGkpID0gdG1wCgogICAgICAgIE5leHQKICAgIEVuZCBTdWIKRW5kIE1vZHVsZQ==