-
Notifications
You must be signed in to change notification settings - Fork 6
/
Ada King.py
136 lines (119 loc) · 2.26 KB
/
Ada King.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
for _ in range(int(input())):
r,c,k=map(int,input().split())
s=0
one=k
r1=r
r1 -= 1
while one>0 and r1>0:
r1-=1
if ((r1-r)**2)+((c-c)**2) <= 2:
s+=1
else:
break
one-=1
print("s one: "+str(s))
s2=0
two = k
r1 = r
r1 += 1
while two > 0 and r1 < 9:
r1 += 1
if ((r1 - r) ** 2) + ((c - c) ** 2) <= 2:
s += 1
s2+=1
else:
break
two-=1
print("s two: " + str(s2))
s3=0
three = k
c1 = c
c1 -= 1
while three > 0 and c1 > 0:
c1 -= 1
if ((r - r) ** 2) + ((c1 - c) ** 2) <= 2:
s += 1
s3+=1
else:
break
three-=1
print("s three: " + str(s3))
s4=0
four = k
c1 = c
c1 += 1
while four > 0 and c1 < 9:
c1 += 1
if ((r - r) ** 2) + ((c1 - c) ** 2) <= 2:
s += 1
s4+=1
else:
break
four-=1
print("s four: " + str(s4))
s5=0
five = k
r1 = r
c1=c
r1 -= 1
c1 -= 1
while five > 0 and r1 > 0 and c1 >0:
r1 -= 1
c1-=1
if ((r1 - r) ** 2) + ((c1 - c) ** 2) <= 2:
s += 1
s5+=1
else:
break
five-=1
print("s five: " + str(s5))
s6=0
six = k
r1 = r
c1=c
r1 += 1
c1 += 1
while six > 0 and r1 < 9 and c1 < 9:
r1 += 1
c1+=1
if ((r1 - r) ** 2) + ((c1 - c) ** 2) <= 2:
s += 1
s6+=1
else:
break
six-=1
print("s six: " + str(s6))
s7=0
seven = k
r1 = r
c1=c
r1 -= 1
c1 += 1
while seven > 0 and r1 > 0 and c1 < 9:
r1 -= 1
c1+=1
if ((r1 - r) ** 2) + ((c1 - c) ** 2) <= 2:
s += 1
s7+=1
else:
break
seven-=1
print("s seven: " + str(s7))
s8=0
eight = k
r1 = r
c1=c
r1 += 1
c1 -= 1
while eight > 0 and r1 < 9 and c1 > 0:
r1 += 1
c1-=1
if ((r1 - r) ** 2) + ((c1 - c) ** 2) <= 2:
s += 1
s8+=1
else:
break
eight-=1
print("s eight: " + str(s8))
s+=1
print(s)