文章

8

粉丝

118

获赞

23

访问

1.6k

头像
细菌的繁殖 题解:
P1033
发布于2025年3月15日 21:49
阅读数 227

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

int main(){
	int n,x;
	cin >> n;
	while(n--){
		cin >> x;
		if(x == 0 || x == 1) cout << 1 << endl;
		else{
			int ans = 0;
			for(int i = 1; i < (2 * x - 1); i += 2){
				ans += 2 * i;
			}
			ans += (2 * x - 1);
			cout << ans << endl;
		}
	}
	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发