array swap
Submit solution
Points:
50 (partial)
Time limit:
1.0s
Memory limit:
256M
Authors:
Problem type
Allowed languages
Java 19, Java 8
題目說明
給定一陣列,長度為5,輸入兩個數字,第一個數字代表要更換的位置,第二個數字代表更換到的位置,最後輸出更換位置後的陣列
輸入
陣列內的值與兩個數字,更換前的位置與欲更換到的位置
輸出
更換位置後的陣列
sample input1
1 2 1 2 1 0 1
sample output1
2 1 1 2 1
sample input2
1 2 3 4 5 4 0
sample output2
5 2 3 4 1
Comments