Did not understand the last testcase when t ==7 | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Did not understand the last testcase when t ==7

2nd Mar 2021, 10:08 AM
RuntimeERROR
RuntimeERROR - avatar
3 Respostas
+ 2
Share links in description , not in question place, it wont work there.. https://open.kattis.com/problems/basicprogramming1 : edited thanks for edit..
2nd Mar 2021, 10:10 AM
Jayakrishna šŸ‡®šŸ‡³
+ 1
7. a. Start from indexĀ i=0; b. Jump to indexĀ i=A[i] c. If the current indexĀ iĀ is outside the valid bound of [0..N-1], print ā€œOutā€ and stop; d. Else if the current indexĀ i is indexĀ N-1, print ā€œDoneā€ and stop; e1. Otherwise, repeat step b; e2. If doing this leads to an infinite loop, print ā€œCyclicā€ and stop; Ā  Sample : 3 7 1 0 4 Here, A) starts from i=0, B) i=a[i]= a[0]=1 C) Current index is i<7 ,within the range (else print "out" .) so e1) repeat B, i=a[1]=0 so this will get repeated so according to e2: print "cyclic" D) if(i==7) print done hope it helps...
2nd Mar 2021, 10:27 AM
Jayakrishna šŸ‡®šŸ‡³
2nd Mar 2021, 10:13 AM
RuntimeERROR
RuntimeERROR - avatar