Skip to content

Commit a25670e

Browse files
committed
fix: update go code
1 parent dcf0373 commit a25670e

File tree

2 files changed

+42
-42
lines changed

2 files changed

+42
-42
lines changed

solution/3500-3599/3528.Unit Conversion I/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -170,27 +170,27 @@ public:
170170
171171
```go
172172
func baseUnitConversions(conversions [][]int) []int {
173-
const mod = int(1e9 + 7)
174-
n := len(conversions) + 1
175-
176-
g := make([][]struct{ t, w int }, n)
177-
for _, e := range conversions {
178-
s, t, w := e[0], e[1], e[2]
179-
g[s] = append(g[s], struct{ t, w int }{t, w})
180-
}
181-
182-
ans := make([]int, n)
183-
184-
var dfs func(s int, mul int)
185-
dfs = func(s int, mul int) {
186-
ans[s] = mul
187-
for _, e := range g[s] {
188-
dfs(e.t, mul*e.w%mod)
189-
}
190-
}
191-
192-
dfs(0, 1)
193-
return ans
173+
const mod = int(1e9 + 7)
174+
n := len(conversions) + 1
175+
176+
g := make([][]struct{ t, w int }, n)
177+
for _, e := range conversions {
178+
s, t, w := e[0], e[1], e[2]
179+
g[s] = append(g[s], struct{ t, w int }{t, w})
180+
}
181+
182+
ans := make([]int, n)
183+
184+
var dfs func(s int, mul int)
185+
dfs = func(s int, mul int) {
186+
ans[s] = mul
187+
for _, e := range g[s] {
188+
dfs(e.t, mul*e.w%mod)
189+
}
190+
}
191+
192+
dfs(0, 1)
193+
return ans
194194
}
195195
```
196196

solution/3500-3599/3528.Unit Conversion I/README_EN.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -168,27 +168,27 @@ public:
168168
169169
```go
170170
func baseUnitConversions(conversions [][]int) []int {
171-
const mod = int(1e9 + 7)
172-
n := len(conversions) + 1
173-
174-
g := make([][]struct{ t, w int }, n)
175-
for _, e := range conversions {
176-
s, t, w := e[0], e[1], e[2]
177-
g[s] = append(g[s], struct{ t, w int }{t, w})
178-
}
179-
180-
ans := make([]int, n)
181-
182-
var dfs func(s int, mul int)
183-
dfs = func(s int, mul int) {
184-
ans[s] = mul
185-
for _, e := range g[s] {
186-
dfs(e.t, mul*e.w%mod)
187-
}
188-
}
189-
190-
dfs(0, 1)
191-
return ans
171+
const mod = int(1e9 + 7)
172+
n := len(conversions) + 1
173+
174+
g := make([][]struct{ t, w int }, n)
175+
for _, e := range conversions {
176+
s, t, w := e[0], e[1], e[2]
177+
g[s] = append(g[s], struct{ t, w int }{t, w})
178+
}
179+
180+
ans := make([]int, n)
181+
182+
var dfs func(s int, mul int)
183+
dfs = func(s int, mul int) {
184+
ans[s] = mul
185+
for _, e := range g[s] {
186+
dfs(e.t, mul*e.w%mod)
187+
}
188+
}
189+
190+
dfs(0, 1)
191+
return ans
192192
}
193193
```
194194

0 commit comments

Comments
 (0)