Help me in solving JAARRAYARR1 problem

My issue

not able to understand how to get logic of this problem

Learning course: Arrays using Java
Problem Link: CodeChef: Practical coding for everyone

@ityagisarthak
This will be the correct code for this problem . Hope u will get it.

int total_cost = 0;
int i = 0;
while (i < N) {
    if (A[i] >= X) {
        total_cost = total_cost + B[i];
    }
    i = i + 1;
}
System.out.print(total_cost);