I'm using the inputs and outputs from http://acm.ashland.edu/2004/problem-set.html
input: http://acm.ashland.edu/2004/Problem-Set/Data/G.dat
output: http://acm.ashland.edu/2004/Problem-Set/Data/G.diff
all my inputs and outputs seem to match up but i still get a WA. The only thing i can think of is that its a problem with the zero. What does the online judge want to happen with the input of "0"? Any help is greatly appreciated.
here is my code:
import sys
def main():
num_input = int(raw_input())
string_input = list(raw_input())
row_list = process(num_input, string_input)
display(row_list, num_input)
def process( columns, string ):
num_rows = len(string)/columns
odd_even = 0
j = ""
row_list = []
for row in range(num_rows):
row_add = []
for letter in range(columns):
row_add.append(string.pop(0))
if odd_even == 0: odd_even =1
elif odd_even == 1:
row_add.reverse()
odd_even = 0
row_list.append(j.join(row_add))
return row_list
def display(rows, columns):
shitstring = ""
for index in range(columns):
for row in range(len(rows)):
sys.stdout.write(rows[row][index])
try:
main()
except(ZeroDivisionError):
pass
created
last reply
- 4
replies
- 164
views
- 4
users
- 3
links