文章

133

粉丝

17

获赞

440

访问

22.8k

头像
整数和 题解:
P1428 北京理工大学机试题
发布于2026年3月20日 20:03
阅读数 179

#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<map>
using namespace std;
int main() {
	int n, num;
	cin >> n;
	while (n--) {
		cin >> num;
		cout << (num + 2 * num) * (abs(2 * num) - abs(num) + 1) / 2 << endl;
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发