fork download
  1.  
  2. Module module1
  3. Sub main()
  4.  
  5. Dim d As Integer() = {1, 2, 3, 4}
  6. narabe(d, d.Length, d.Length)
  7. End Sub
  8.  
  9.  
  10. Sub kekka_shori(ByRef d As Integer(), len As Integer)
  11. Dim i As Integer
  12. Dim arr(len - 1) As Integer
  13.  
  14. i = 0
  15. While (i < len)
  16. Console.Write(d(i))
  17. i += 1
  18. End While
  19. Console.WriteLine()
  20. End Sub
  21.  
  22.  
  23. Sub narabe(ByRef d As Integer(), len As Integer, n As Integer)
  24.  
  25. Dim i, j As Integer
  26. Dim tmp As Integer
  27.  
  28. If n <= 1 Then
  29. kekka_shori(d, len)
  30. Return
  31. End If
  32.  
  33. For j = 0 To n - 1
  34. narabe(d, len, n - 1)
  35. tmp = d(len - n)
  36.  
  37.  
  38. For i = 0 To n - 2
  39. d(len - n + i) = d(len - n + i + 1)
  40.  
  41. Next
  42. d(len - n + i) = tmp
  43.  
  44. Next
  45. End Sub
  46. End Module
Success #stdin #stdout 0.07s 13472KB
stdin
Standard input is empty
stdout
1234
1243
1342
1324
1423
1432
2341
2314
2413
2431
2134
2143
3412
3421
3124
3142
3241
3214
4123
4132
4231
4213
4312
4321