0
点赞
收藏
分享

微信扫一扫

oj 1010: Drawing Lines

天天天蓝loveyou 2022-04-16 阅读 34
c语言

Description

Little Johnny likes to draw a lot. A few days ago he painted lots of straight lines on his sheet of paper. Then he counted in how many zones the sheet of paper was split by these lines. He noticed that this number is not always the same. For instance, if he draws 2 lines, the sheet of paper could be split into 43 or even 2 (if the lines are identical) zones. Since he is a very curious kid, he would like to know which is the maximum number of zones into which he can split the sheet of paper, if he draws N lines. The sheet of paper is to be considered a very large (=infinite) rectangle.

Input

The input file will contain an integer number:T(T<=1000);

then will contain T integers :N (0<=N<=65535).

Output

You should output: the maximum number of zones into which the sheet of paper can be split if Johnny draws N lines

Sample Input

2 0 1

Sample Output

1 2

#include<stdio.h> 
int main()
{
	int t;
	double n,ans;
	scanf("%d",&t);
	while(t--){
		scanf("%lf",&n);
		ans=(n*n+n+2)/2;
		printf("%.0lf\n",ans);
	}
	return 0;
}
举报

相关推荐

0 条评论