正方形数量问题终极解答


废了不少脑细胞

    public static int newsquareCount(int a , int b){
        int k=a<b?

a:b; return k*(k+1)*(2*k+1)/6+(Math.abs(a-b)*k*(k+1)/2); }



posted on 2017-07-11 12:37  wgwyanfs  阅读(165)  评论(0编辑  收藏  举报

导航