回答編集履歴

2

バグ修正

2019/10/02 14:13

投稿

nomuken
nomuken

スコア1627

test CHANGED
@@ -52,27 +52,53 @@
52
52
 
53
53
 
54
54
 
55
+ standard_value = 20
56
+
55
57
  NUMBERS=4
56
58
 
57
59
  a = 0
58
60
 
59
61
 
60
62
 
61
- for base_y in range(len(values)-NUMBERS+1):
63
+ for base_y in range(standard_value):
62
-
64
+
63
- for base_x in range(len(values[base_y])-NUMBERS+1):
65
+ for base_x in range(standard_value):
64
66
 
65
67
  tmp = [ 1, 1, 1, 1 ]
66
68
 
67
69
  for i in range(NUMBERS):
68
70
 
71
+ if (base_x+NUMBERS <= standard_value):
72
+
69
- tmp[0] *= values[base_y][base_x+i]
73
+ tmp[0] *= values[base_y][base_x+i]
74
+
70
-
75
+ else:
76
+
77
+ tmp[0] = 0
78
+
79
+
80
+
81
+ if (base_y+NUMBERS <= standard_value):
82
+
71
- tmp[1] *= values[base_y+i][base_x]
83
+ tmp[1] *= values[base_y+i][base_x]
84
+
72
-
85
+ else:
86
+
87
+ tmp[1] = 0
88
+
89
+
90
+
91
+ if (base_y+NUMBERS <= standard_value) and (base_x+NUMBERS <= standard_value):
92
+
73
- tmp[2] *= values[base_y+i][base_x+i]
93
+ tmp[2] *= values[base_y+i][base_x+i]
74
-
94
+
75
- tmp[3] *= values[base_y+i][base_x+NUMBERS-(i+1)]
95
+ tmp[3] *= values[base_y+i][base_x+NUMBERS-(i+1)]
96
+
97
+ else:
98
+
99
+ tmp[2] = 0
100
+
101
+ tmp[3] = 0
76
102
 
77
103
 
78
104
 
@@ -104,6 +130,8 @@
104
130
 
105
131
 
106
132
 
133
+ standard_value = 20
134
+
107
135
  NUMBERS=4
108
136
 
109
137
  a = 0
@@ -114,21 +142,47 @@
114
142
 
115
143
 
116
144
 
117
- for base_y in range(len(values)-NUMBERS+1):
145
+ for base_y in range(standard_value):
118
-
146
+
119
- for base_x in range(len(values[base_y])-NUMBERS+1):
147
+ for base_x in range(standard_value):
120
148
 
121
149
  tmp = [ 1, 1, 1, 1 ]
122
150
 
123
151
  for i in range(NUMBERS):
124
152
 
153
+ if (base_x+NUMBERS <= standard_value):
154
+
125
- tmp[0] *= values[base_y][base_x+i]
155
+ tmp[0] *= values[base_y][base_x+i]
156
+
126
-
157
+ else:
158
+
159
+ tmp[0] = 0
160
+
161
+
162
+
163
+ if (base_y+NUMBERS <= standard_value):
164
+
127
- tmp[1] *= values[base_y+i][base_x]
165
+ tmp[1] *= values[base_y+i][base_x]
166
+
128
-
167
+ else:
168
+
169
+ tmp[1] = 0
170
+
171
+
172
+
173
+ if (base_y+NUMBERS <= standard_value) and (base_x+NUMBERS <= standard_value):
174
+
129
- tmp[2] *= values[base_y+i][base_x+i]
175
+ tmp[2] *= values[base_y+i][base_x+i]
130
-
176
+
131
- tmp[3] *= values[base_y+i][base_x+NUMBERS-(i+1)]
177
+ tmp[3] *= values[base_y+i][base_x+NUMBERS-(i+1)]
178
+
179
+ else:
180
+
181
+ tmp[2] = 0
182
+
183
+ tmp[3] = 0
184
+
185
+
132
186
 
133
187
  tmp_a = max(tmp)
134
188
 

1

誤り訂正

2019/10/02 14:13

投稿

nomuken
nomuken

スコア1627

test CHANGED
@@ -114,9 +114,9 @@
114
114
 
115
115
 
116
116
 
117
- for base_y in range(len(values)-NUMBERS):
117
+ for base_y in range(len(values)-NUMBERS+1):
118
118
 
119
- for base_x in range(len(values[base_y])-NUMBERS):
119
+ for base_x in range(len(values[base_y])-NUMBERS+1):
120
120
 
121
121
  tmp = [ 1, 1, 1, 1 ]
122
122