回答編集履歴
1
Update
answer
CHANGED
@@ -15,13 +15,14 @@
|
|
15
15
|
hand = index_on_keyboard(inputs[0], keyboard)[0] / 5
|
16
16
|
mistake = 0
|
17
17
|
|
18
|
-
inputs.chars.
|
18
|
+
inputs.chars.each_cons(2).map{|consecutive|
|
19
19
|
a, b = consecutive.map{|c| index_on_keyboard(c, keyboard)}
|
20
20
|
pos = [[1, 0], [-1, 0], [0, 1], [0, -1]].map{|x, y| [a[0]+x, a[1]+y]}
|
21
|
+
nhand = b[0] / 5
|
21
22
|
if ([a] + pos).include?(b) then
|
22
|
-
mistake += 1 if hand !=
|
23
|
+
mistake += 1 if hand != nhand
|
23
24
|
else
|
24
|
-
hand =
|
25
|
+
hand = nhand
|
25
26
|
end
|
26
27
|
}
|
27
28
|
|