我的算法有问题,它陷入了局部最优。开了一天的会,很累,今天就不调试了。
我制作了一组随机测试数组,通过对比你我代码的输出结果发现了上面的问题。也许你能用得着。
别让这贴沉了,一定要搞定它
我制作了一组随机测试数组,通过对比你我代码的输出结果发现了上面的问题。也许你能用得着。
别让这贴沉了,一定要搞定它
程序代码:
26 17 2 0 1 1 2 0 2 2 1 1 2 1 0 1 1 0 0 1 2 2 2 2 0 1 0 0 17 16 2 1 2 2 1 2 0 2 0 2 2 1 0 2 2 2 1 50 47 2 1 0 1 2 0 2 0 0 1 1 0 1 0 1 1 1 1 1 2 2 1 2 2 2 0 1 0 2 0 0 0 0 1 1 1 2 1 0 2 1 1 2 1 0 2 2 2 0 0 23 5 2 0 1 2 1 0 1 0 1 0 1 0 2 0 2 2 1 1 0 2 1 0 1 14 13 0 1 0 2 2 1 0 2 1 0 1 1 2 1 44 37 0 0 2 0 1 0 2 1 2 0 1 2 2 0 2 0 1 2 0 1 1 1 1 0 1 1 2 2 1 0 0 2 0 1 0 0 2 1 0 1 2 1 0 0 45 24 2 2 0 0 1 1 0 2 2 1 2 2 1 1 1 2 2 0 2 2 1 1 1 2 2 1 1 0 0 2 1 2 0 2 2 2 1 1 0 0 0 2 0 0 1 49 15 1 1 0 0 0 1 1 1 0 0 0 2 2 1 1 2 0 1 0 2 2 0 0 0 2 0 2 0 0 0 1 1 1 0 2 1 1 1 2 1 0 0 0 0 2 2 1 0 2 18 9 1 2 0 0 2 1 1 1 2 1 2 1 2 1 0 1 1 0 14 9 1 0 2 1 0 2 2 2 0 2 1 2 2 2 13 9 0 2 2 2 2 1 0 2 0 1 2 2 2 18 10 0 2 2 1 1 0 1 2 2 1 1 0 2 1 1 0 0 0 38 37 2 1 1 2 1 0 0 1 0 0 0 0 1 1 2 0 0 0 1 1 0 1 0 1 1 0 0 2 0 2 1 0 0 2 2 0 1 1 24 20 2 1 0 0 1 2 1 2 0 2 2 0 1 2 2 0 2 2 1 1 1 2 2 2 49 3 2 2 0 2 2 1 0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