-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11.py
60 lines (45 loc) · 1.05 KB
/
11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
C,N=input().split(" ")
N=int(N)
C=int(C)
error=list(map(int, input().split(" ")))
print(error)
print(N,C)
def exist(n, list):
for a in range(len(list) - 1):
if n == list[a]:
return True
return False
def find_end(a, b, list):
while list[b] - list[a] == b - a:
if b == len(list) - 1:
print(" and ", end="")
return b
b += 1
return b - 1
def print_list(list):
a = 0
b = 1
while b<len(list):
if list[a] + 1 != list[b]:
if a != 0:
print(",",end="")
print(" ",end="")
print(list[a], end="")
a += 1
b += 1
else:
b = find_end(a, b, list)
print(list[a], end="")
print("-",end="")
print(list[b], end="")
a = b + 1
b = a + 1
correct = []
for k in range(1, 21):
if not exist(k, error):
correct.append(k)
print("Errors: ", end="")
print_list(error)
print("")
print("Correct: ", end="")
print_list(correct)