枚举。
看了这个方法:$http://www.cppblog.com/shiming413/archive/2008/12/21/29671.html$
将数字归类的地方不能用$vector$,会超时。$vector$换成数组就可以过,类似于邻接表。
因为题目给出的$16$个数字都是不同的,所以时间复杂度相对还比较低。
下面这组数据是极限数据,我的跑了$3800$$ms$。但测试数据中不会出现这样的数据。
$5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$ $5$
#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include