python-algorithm

백준 16316 Baby Bites

무적김두칠 2023. 1. 4. 10:48

https://www.acmicpc.net/problem/16316

 

16316번: Baby Bites

The first line of input contains an integer n (1 ≤ n ≤ 1 000), the number of bites Arild receives. Then second line contains n space-separated words spoken by Arild, the i’th of which is either a non-negative integer ai (0 ≤ ai ≤ 10 000) or the s

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
def sol(nums):
    for i in range(1,len(nums)+1):
        if nums[i-1].isdigit() and int(nums[i-1]) != i:
                return 'something is fishy'
    return 'makes sense'
 
if __name__ == '__main__':
    n = int(input())
    nums = list(input().split())
    print(sol(nums))
cs
반응형