You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
const int arr[5] = {1,3,4,2};
|
|
int a = 0;
|
|
|
|
int sum(int a, int b){
|
|
return a+b;
|
|
}
|
|
|
|
int main(){
|
|
int cnt = 0;
|
|
while (a < arr[a]) {
|
|
a = arr[a];
|
|
if (arr[a + arr[a] - 1] > arr[a] - 1.5) {
|
|
cnt = arr[cnt] + 1;
|
|
}
|
|
}
|
|
return sum(arr[a], -cnt);
|
|
} |