Array Position Swap


Submit solution

Points: 10 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type
Allowed languages
Java 19, Java 8

題目說明

請撰寫一個程式,讀入兩行整數。

  • 第一行包含 10 個整數。

  • 第二行包含 4 個整數 a、b、c、d。

程式需將第一行中 第 a 與第 b 個位置的數字互換,再將 第 c 與第 d 個位置的數字互換,最後輸出交換後的結果。

sample input1

1 2 3 4 5 6 7 8 9 10
2 3 4 5

sample output1

1 2 4 3 6 5 7 8 9 10

sample input2

10 9 8 7 6 5 4 3 2 1
0 9 1 8

sample output2

1 2 8 7 6 5 4 3 9 10

Comments

There are no comments at the moment.