文章

54

粉丝

66

获赞

54

访问

3.6k

头像
求1到n的和 (等差数列)题解:
P1133 北京大学机试题
发布于2024年4月21日 00:02
阅读数 80

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;

int n;
LL ans;

int main()
{
	cin >> n;
	
	ans = n * (1 + n) / 2;
	
	cout << ans;
	
	return 0;	
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发