Submission #551627


Source Code Expand

# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())
# get two integers separated with half-width break
#b, c = map(int, raw_input().split())
# get a string
#s = raw_input()
# output
#print str(a+b+c) + " " + s
def tempz(a):
		global temp2, temp
		if temp[a] == "+":
			if temp2[a] + 1 == 10:
				temp2[a] = 9
				temp[a] = "-"
				return 1
			else:
				temp2[a] = temp2[a] + 1
				return 0
		else:
			
			if temp2[a] - 1 == -1:
				temp2[a] = 0
				temp[a] = "+"
				return 1
			else:
				temp2[a] = temp2[a] - 1
				return 0

global temp2, temp
if a >= 1 and a <=5:
	print int(pow(10, a) - 1)
	temp = []
	temp2= []
	for x in range(a):
		temp.append("+")
	for x in range(a):
		temp2.append(0)
	output = 0 
	temp2[a-1] = -1
	for x in range(pow(10, a)):
		for z in range(a, 0, -1):
			if tempz(z - 1) == 0:
				break
		output = output +1
		st = ""
		for y in range(a):
			st = st + str(temp2[y])
		print st

	

Submission Info

Submission Time
Task A - Lock
User rhd_may_20151282
Language Python (2.7.3)
Score 100
Code Size 968 Byte
Status AC
Exec Time 621 ms
Memory 6840 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 5
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 66 ms 3732 KB
subtask0_sample_02.txt AC 63 ms 3728 KB
subtask1_01.txt AC 68 ms 3728 KB
subtask1_02.txt AC 114 ms 4000 KB
subtask1_03.txt AC 621 ms 6840 KB