Skip to content

Instantly share code, notes, and snippets.

@popey456963
Created May 28, 2016 20:06
Show Gist options
  • Save popey456963/8260381aeae2459027b4ed575dab45ad to your computer and use it in GitHub Desktop.
Save popey456963/8260381aeae2459027b4ed575dab45ad to your computer and use it in GitHub Desktop.
Alternating Sign Sequence
n,k=int(input()),0
if not n-1%3:k=0
elif not n%3:k=(n/3)+1
else:k=-(n/3)+1
print(k)
@developius
Copy link

a=[]
n=input()
for i in range(1,n+2):a.extend([i,0,i*-1])
print a[n]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment