原题: Jill likes to ride her bicycle, but since the pretty city of Greenhills where she lives has grown, Jill often uses the excellent public bus system for part of her journey. She has a folding bicyc
思路不难,就是暴力, 两层暴力。不过要剪枝, 考虑那次循环是无用的,则跳过那样的耗时、 假如1~m目前求得的最大值是M。 那么如果a[1]>0的话,就没有必要让i=2再来一次循环了,因为a[1]>0,所以2~m最大值会比M少a[1].,所以把这样的无用功剪去就好了 代码如下: #include <cstdio>#define M 20010int n, a[M];int ma