用python把Codejam初章中的程序写了一遍,果然简洁很多。
'''
Created on 2012-12-9
@author: festony
'''
import sys
input_file_path = 'G:\\Project\\e_p_workspace\\codejam_inout\\testin.txt'
output_file_path = 'G:\\Project\\e_p_workspace\\codejam_inout\\testout.txt'
def process_cases(process_func):
case_total_num = int(raw_input())
result = ''
for i in range(case_total_num):
result += process_func(i+1) + '\n'
print result
return result
def run(process_func):
oldstdin = sys.stdin
inputfile = open(input_file_path, 'r')
outputfile = open(output_file_path, 'w')
sys.stdin = inputfile
outputfile.write(process_cases(process_func))
sys.stdin = oldstdin
#def process_func(case_num):
# pass
#run()
善!