#include <stdio.h>
// swap関数の定義
void swap(int* x, int* y) {
int temp = *x;
*x = *y;
*y = temp;
}
int main() {
// 配列の宣言と初期化
int data1[5] = {1, 2, 3, 4, 5};
int data2[5] = {6, 7, 8, 9, 10};
// 交換前の配列を表示
for(int i = 0; i < 5; i++) {
}
for(int i = 0; i < 5; i++) {
}
// 配列の要素を入れ替え
for(int i = 0; i < 5; i++) {
swap(&data1[i], &data2[i]);
}
// 交換後の配列を表示
for(int i = 0; i < 5; i++) {
}
for(int i = 0; i < 5; i++) {
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgovLyBzd2Fw6Zai5pWw44Gu5a6a576pCnZvaWQgc3dhcChpbnQqIHgsIGludCogeSkgewogICAgaW50IHRlbXAgPSAqeDsKICAgICp4ID0gKnk7CiAgICAqeSA9IHRlbXA7Cn0KCmludCBtYWluKCkgewogICAgLy8g6YWN5YiX44Gu5a6j6KiA44Go5Yid5pyf5YyWCiAgICBpbnQgZGF0YTFbNV0gPSB7MSwgMiwgMywgNCwgNX07CiAgICBpbnQgZGF0YTJbNV0gPSB7NiwgNywgOCwgOSwgMTB9OwogICAgCiAgICAvLyDkuqTmj5vliY3jga7phY3liJfjgpLooajnpLoKICAgIHByaW50Zigi5Lqk5o+b5YmNOlxuIik7CiAgICBwcmludGYoImRhdGExOiAiKTsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCA1OyBpKyspIHsKICAgICAgICBwcmludGYoIiVkICIsIGRhdGExW2ldKTsKICAgIH0KICAgIHByaW50ZigiXG5kYXRhMjogIik7CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgNTsgaSsrKSB7CiAgICAgICAgcHJpbnRmKCIlZCAiLCBkYXRhMltpXSk7CiAgICB9CiAgICBwcmludGYoIlxuXG4iKTsKICAgIAogICAgLy8g6YWN5YiX44Gu6KaB57Sg44KS5YWl44KM5pu/44GICiAgICBmb3IoaW50IGkgPSAwOyBpIDwgNTsgaSsrKSB7CiAgICAgICAgc3dhcCgmZGF0YTFbaV0sICZkYXRhMltpXSk7CiAgICB9CiAgICAKICAgIC8vIOS6pOaPm+W+jOOBrumFjeWIl+OCkuihqOekugogICAgcHJpbnRmKCLkuqTmj5vlvow6XG4iKTsKICAgIHByaW50ZigiZGF0YTE6ICIpOwogICAgZm9yKGludCBpID0gMDsgaSA8IDU7IGkrKykgewogICAgICAgIHByaW50ZigiJWQgIiwgZGF0YTFbaV0pOwogICAgfQogICAgcHJpbnRmKCJcbmRhdGEyOiAiKTsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCA1OyBpKyspIHsKICAgICAgICBwcmludGYoIiVkICIsIGRhdGEyW2ldKTsKICAgIH0KICAgIHByaW50ZigiXG4iKTsKICAgIAogICAgcmV0dXJuIDA7Cn0K