#K58077. Find the First Element Not Smaller than k
Find the First Element Not Smaller than k
Find the First Element Not Smaller than k
You are given a list of integers and an integer ( k ). Your task is to find the index of the first element in the list that is not smaller than ( k ). In other words, identify the smallest index ( i ) such that ( a_i \geq k ). If no such element exists, output (-1).
For example, if the input list is [1, 3, 5, 7, 9] and ( k = 5 ), then the answer is 2 because the element at index 2 is 5, which satisfies ( 5 \geq 5 ).
inputFormat
The input is read from standard input. The first line contains an integer ( n ) representing the number of elements in the list. The second line contains ( n ) space-separated integers representing the list. The third line contains the integer ( k ).
outputFormat
Print a single integer to standard output representing the index of the first element that is not smaller than ( k ). If no such element exists, print (-1).## sample
5
1 3 5 7 9
5
2