mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-05 00:25:22 +08:00
64 lines
1.1 KiB
Go
64 lines
1.1 KiB
Go
package leetcode
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
type question924 struct {
|
|
para924
|
|
ans924
|
|
}
|
|
|
|
// para 是参数
|
|
// one 代表第一个参数
|
|
type para924 struct {
|
|
graph [][]int
|
|
initial []int
|
|
}
|
|
|
|
// ans 是答案
|
|
// one 代表第一个答案
|
|
type ans924 struct {
|
|
one int
|
|
}
|
|
|
|
func Test_Problem924(t *testing.T) {
|
|
|
|
qs := []question924{
|
|
|
|
{
|
|
para924{[][]int{{1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 1}, {0, 0, 1, 1}}, []int{3, 1}},
|
|
ans924{3},
|
|
},
|
|
|
|
{
|
|
para924{[][]int{{1, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 1, 1, 0}, {0, 0, 0, 0, 0, 1}}, []int{5, 0}},
|
|
ans924{0},
|
|
},
|
|
|
|
{
|
|
para924{[][]int{{1, 1, 1}, {1, 1, 1}, {1, 1, 1}}, []int{1, 2}},
|
|
ans924{1},
|
|
},
|
|
|
|
{
|
|
para924{[][]int{{1, 1, 0}, {1, 1, 0}, {0, 0, 1}}, []int{0, 1}},
|
|
ans924{0},
|
|
},
|
|
|
|
{
|
|
para924{[][]int{{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}, []int{0, 2}},
|
|
ans924{0},
|
|
},
|
|
}
|
|
|
|
fmt.Printf("------------------------Leetcode Problem 924------------------------\n")
|
|
|
|
for _, q := range qs {
|
|
_, p := q.ans924, q.para924
|
|
fmt.Printf("【input】:%v 【output】:%v\n", p, minMalwareSpread(p.graph, p.initial))
|
|
}
|
|
fmt.Printf("\n\n\n")
|
|
}
|