文章

117

粉丝

69

获赞

1115

访问

235.2k

头像

计算Sn (模拟,注意数据范围)题解:

P1043 北京大学机试题
发布于 2024年4月
阅读数 2.1k

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

int x, n;
LL ans;

int main()
{
	cin >> x >> n;
	
	LL t = 0;
	for(int i = 1; i <= n; i ++)
	{
		t = (t * 10 + x);
		ans += t;
	}
	
	cout << ans;
	
	return 0;	
}

 



登录后发布评论

暂无评论,来抢沙发