#C4506. Find Out-of-Stock Sandwich Index
Find Out-of-Stock Sandwich Index
Find Out-of-Stock Sandwich Index
You are given the sales data of different types of sandwiches. Each sandwich type is represented by an integer indicating its number of sales. There is exactly one sandwich type that is out of stock (i.e., its sales number is 0). Your task is to determine the 1-indexed position of this out-of-stock sandwich.
For example, if the input sales data is [5, 7, 0, 9, 4], then the sandwich at index (3) (1-indexed) is out of stock.
inputFormat
The input consists of two lines:
- The first line contains an integer (n) representing the number of sandwich types.
- The second line contains (n) space-separated integers, where each integer denotes the number of sales for a sandwich type.
outputFormat
Output a single integer which is the 1-indexed position of the sandwich that is out of stock (i.e., the one with 0 sales).## sample
5
5 7 0 9 4
3