2020年12月19日星期六

I am not able to find the error in this code . Problem is to cylindrically rotate an array by one

t= int(input()) while t>0:

n =int(input())  a =list(map(int,input().strip().split()))  if n==1:      print(a[0])        else:      c= []      c.append(a[n-1])      for i in range(n-1):          c.append(a[i])      for x in c:          print(x,end =" ")  t= t-1  

ERROR is : !!!Wrong Answer

Possibly your code doesn't work correctly for multiple test-cases (TCs).

The first test case where your code failed:

Input: 2 1 2

Its Correct output is: 2 1

And Your Code's output is: 2 1 3 1 2 4 1 2 3 7 1 8 7 5 6 7 8 3 9 8 7 6 4 2 1 17 ... ############################# But this is not the output with this input . On compile and run the output is same as expected but now it is changing my output.

https://stackoverflow.com/questions/65376986/i-am-not-able-to-find-the-error-in-this-code-problem-is-to-cylindrically-rotat December 20, 2020 at 12:45PM

没有评论:

发表评论