1
301 2020-12-18 12:33:57 +08:00 via Android
有一半
|
2
sirnay 2020-12-18 12:34:43 +08:00
[554221 545221 455221 552421 525421 542521 452521 524521 425521 552241 525241 522541 542251 452251 524251 425251 522451 422551 554212 545212 455212 552412 525412 542512 452512 524512 425512 554122 545122 455122 551422 515422 541522 451522 514522 415522 552142 525142 551242 515242 521542 512542 542152 452152 524152 425152 541252 451252 514252 415252 521452 512452 421552 412552 552214 525214 522514 552124 525124 551224 515224 521524 512524 522154 521254 512254 542215 452215 524215 425215 522415 422515 542125 452125 524125 425125 541225 451225 514225 415225 521425 512425 421525 412525 522145 521245 512245 422155 421255 412255]
|
3
sirnay 2020-12-18 12:35:30 +08:00
func permuteUnique(nums []int) (ans int) {
sort.Ints(nums) n := len(nums) perm := []int{} vis := make([]bool, n) r := make([]int, 0) var backtrack func(int) backtrack = func(idx int) { if idx == n { tmp := make([]int, len(perm)) copy(tmp, perm) sum := 0 for i := 0; i < len(perm); i++ { sum += tmp[i] * int(math.Pow10(i)) } if sum > 300000 { ans++ r = append(r, sum) } return } for i, v := range nums { // if vis[i] || i > 0 && !vis[i-1] && v == nums[i-1] { continue } perm = append(perm, v) vis[i] = true backtrack(idx + 1) vis[i] = false perm = perm[:len(perm)-1] } } backtrack(0) return } |
4
sirnay 2020-12-18 12:36:48 +08:00
|
5
Inn0Vat10n 2020-12-18 12:38:38 +08:00 1
A(6,6)/2/2/2=90
|
6
dustinth 2020-12-18 12:43:57 +08:00
C(3, 1) * C(5, 5) / 4 = 90
|
7
ArtsXiaoLu 2020-12-18 12:57:17 +08:00
http://www.ab126.com/shuxue/1641.html
这问题找李永乐回答合适 |
8
bankroft 2020-12-18 13:10:24 +08:00
C(3,1)*P(5,5)/(P(2,2)^2)
|
9
iXingo OP 谢谢诸位老铁
|