src2020/1660_n+/main.cpp

16 lines
215 B
C++

//½×¼Ó£¨³¬Ð¡£©
#include <iostream>
using namespace std;
long long dg(long long n){
if(n==1){
return 1;
}
return n+dg(n-1);
}
int main()
{
int n;
cin>>n;
cout<<dg(n);
}