arrow_forward همه ارسال‌ها

جزئیات ارسال کد#869

code_blocks
مسئله مربوطه: شیفت آرایه به راست (#20) arrow_outward
verified
وضعیت داوری نهایی: پذیرفته شد
terminal
زبان برنامه‌نویسی: Python
schedule
ارسال‌کننده و زمان:
Amir Mohammad Baghche sara (۱۰ ماه پیش)
descriptionsolution.py ۱۸ خط • ۲۶۶ بایت
1n = list(map(int, input().split()))
2numbers = list(map(int, input().split()))
3
4
5s0=n[1]
6l=n[0]
7s= s0%l
8shifted = [None] * l
9
10
11
12for i in range(l):
13 if i + s < l:
14 shifted[i + s]=numbers[i]
15 else:
16 shifted[i + s - l] = numbers[i]
17
18print(*shifted)
کد ارسال‌شده برای داوری خودکار هاتکدز UTF-8