#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;
const int N=1e5+9;
#define line ‘\n‘
#define gt getchar()
#define mid ((L+R)>>1)
int read(){int x=0,op=1;char c=gt;while(!isdigit(c)){if(c==‘-‘)op=-1;c=gt;}while(isdigit(c))x=x*10+c-48,c=gt;return x*op;}
int main()
{
	int n=read();
	cout<<1LL*n*(n+1)/2<<line; 
	return 0;
}
原文:https://www.cnblogs.com/ZeroOne-World/p/12706002.html