#include <iostream>
using namespace std;
int s(int);
int main()
{
int n;
cin>>n;
cout<<s(n)<<endl;
system("pause");
return 0;
}
int s(int n)
{
int m=0;
if(n==1)m=1;
else if(n==0)m=0;
else m=m+n*n+s(n-1);
return m;
}
标签:cin ios names pause system body stream ace pos
#include <iostream>
using namespace std;
int s(int);
int main()
{
int n;
cin>>n;
cout<<s(n)<<endl;
system("pause");
return 0;
}
int s(int n)
{
int m=0;
if(n==1)m=1;
else if(n==0)m=0;
else m=m+n*n+s(n-1);
return m;
}
标签:cin ios names pause system body stream ace pos
原文地址:https://www.cnblogs.com/Eternal-kong/p/8425424.html