瀏覽代碼

Correction

Piotr Czajkowski 1 年之前
父節點
當前提交
be8bf216dd
共有 1 個文件被更改,包括 6 次插入7 次删除
  1. 6 7
      03/code.go

+ 6 - 7
03/code.go

@@ -68,7 +68,12 @@ func part1(lines []string) int {
 		var start, end int
 		var start, end int
 		gotNumber := false
 		gotNumber := false
 		for j := range lines[i] {
 		for j := range lines[i] {
-			if lines[i][j] == '.' {
+			if isDigit(lines[i][j]) {
+				if !gotNumber {
+					start = j
+					gotNumber = true
+				}
+			} else {
 				if !gotNumber {
 				if !gotNumber {
 					continue
 					continue
 				}
 				}
@@ -86,12 +91,6 @@ func part1(lines []string) int {
 				}
 				}
 			}
 			}
 
 
-			if isDigit(lines[i][j]) {
-				if !gotNumber {
-					start = j
-					gotNumber = true
-				}
-			}
 		}
 		}
 	}
 	}