1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 using namespace std; 6 int main() 7 { 8 int num; 9 while(cin>>num) 10 { 11 int sum=(pow(num,3)*(pow(num,3)-1)/2)-pow(num,2)*3*(num-1); 12 cout<<sum<<endl; 13 } 14 }
原文:http://www.cnblogs.com/a1225234/p/4592286.html