HDU 1977 Consecutive sum II

http://acm.hdu.edu.cn/showproblem.php?pid=1977

很容易看出规律

View Code
#include <stdio.h>

#include <string.h>

int main()

{

    int t;

    __int64 n;

    scanf("%d",&t);

    while(t--)

    {

        scanf("%I64d",&n);

        printf("%I64d %I64d\n",n*n*n,(n+1)*(n+1)*(n+1));

    }

    return 0;

}

 

 

你可能感兴趣的:(HDU)