Today Shi Dabi race, this question A:snake filled mainly is the teammate to make, I make a record of Jane

Source: Internet
Author: User

"What a boring world!"
Julyed felt so bored, she began to write numbers on the coordinate paper. She wrote a "0" on the center, then wrote the follow numbers clockwise, and which looked like a snake as below.

"Damn! I have fulfilled the paper! "
Julyed was looking at paper. Suddenly, she began to feel curious.
"What's the nth number on the positive axis of Y axis?"
She asked tomriddly for the question. But tomriddly is so busy that he ignored julyed. So is now there to the solve this problem.

Enter multiple test cases.
The first line contains an integer t (t <=), indicating the number of test cases.
Then T-lines follows, one line per case. Each line contains a positive integer n (n <= 3000).

Output one line per case. An integer indicates the nth number on the positive axis of Y axis. Program Design: #include <stdio.h>
#include <math.h>
int main ()
{
int A, B;
int s;
int t;
while (scanf ("%d", &a)!=eof) {
int i;
for (i=0;i<a;i++) {
scanf ("%d", &b);
S=pow (b+b+1,2);
t=s-(b+b+1)-(b+b+1)/2;
printf ("%d\n", t);
}
}
return 0;
}

Today Shi Dabi race, this question A:snake filled mainly is the teammate to make, I make a record of Jane

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.