Skip to content

Instantly share code, notes, and snippets.

@page2me
Created October 2, 2020 13:40
Show Gist options
  • Save page2me/3bb36597f7e1c9b01168fcb73fd9c58d to your computer and use it in GitHub Desktop.
Save page2me/3bb36597f7e1c9b01168fcb73fd9c58d to your computer and use it in GitHub Desktop.

Revisions

  1. @hekar hekar revised this gist Aug 10, 2016. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion main.py
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,10 @@ def main():
    (n, k, q) = line_int()
    arr = line_int()

    r = k%n
    for j in range(q):
    m = int(input())
    print (arr[(m + k) % n])
    i = (m - r)
    print (arr[i if i >= 0 else i + n])

    main()
  2. @hekar hekar renamed this gist Aug 10, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @hekar hekar created this gist Aug 10, 2016.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/usr/bin/env python

    def line_int():
    return [int(x) for x in input().split(' ')]

    def main():
    (n, k, q) = line_int()
    arr = line_int()

    for j in range(q):
    m = int(input())
    print (arr[(m + k) % n])

    main()