#include <stdio.h>
void modify(int *arr, int size) {
int *ptr = arr + size - 1;
while (ptr >= arr) {
*ptr = (*ptr) * (*ptr) - *(arr + (ptr - arr) / 2);
ptr--;
}
}
int main() {
int arr[5] = {1, 2, 3, 4, 5};
modify(arr, 5);
int *p = arr;
int sum = 0;
for (int i = 0; i < 5; i++) {
sum += *(p++);
if (i % 2 == 0) {
sum -= arr[i/2];
}
}
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+Cgp2b2lkIG1vZGlmeShpbnQgKmFyciwgaW50IHNpemUpIHsKICAgIGludCAqcHRyID0gYXJyICsgc2l6ZSAtIDE7CiAgICB3aGlsZSAocHRyID49IGFycikgewogICAgICAgICpwdHIgPSAoKnB0cikgKiAoKnB0cikgLSAqKGFyciArIChwdHIgLSBhcnIpIC8gMik7CiAgICAgICAgcHRyLS07CiAgICB9Cn0KCmludCBtYWluKCkgewogICAgaW50IGFycls1XSA9IHsxLCAyLCAzLCA0LCA1fTsKICAgIG1vZGlmeShhcnIsIDUpOwogICAgaW50ICpwID0gYXJyOwogICAgaW50IHN1bSA9IDA7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IDU7IGkrKykgewogICAgICAgIHN1bSArPSAqKHArKyk7CiAgICAgICAgaWYgKGkgJSAyID09IDApIHsKICAgICAgICAgICAgc3VtIC09IGFycltpLzJdOwogICAgICAgIH0KICAgIH0KICAgIHByaW50ZigiJWRcbiIsIHN1bSk7CiAgICByZXR1cm4gMDsKfQ==