2050:

#include <cstdio>

using namespace std;
typedef long long LL;

LL a[10000+7];

int main()
{
    a[1] = 2;
    for(int i=2; i<=10000; i++)
    {
        a[i] = a[i-1] + 4 * (i-1) + 1;
    }
    int t;
    scanf("%d", &t);
    while(t--)
    {
        int num;
        scanf("%d", &num);
        printf("%lld\n", a[num]);
    }


    return 0;
}

2051:

// 十进制到二进制得转换
#include <cstdio>
#include <stack>

using namespace std;

stack<int> s;
void change(int n)
{
    do{
        s.push(n%2);
        n /= 2;
    }while(n);
}

int main()
{
    int n;
    while(scanf("%d", &n) != EOF)
    {
        while(!s.empty()) s.pop();
        change(n);        
        while(!s.empty())
        {
            printf("%d", s.top());
            s.pop();
        }
        printf("\n");
    }


    return 0;
}

2052:

#include <cstdio>

using namespace std;

int main()
{
    int n, m;
    while(scanf("%d%d", &n, &m) != EOF)
    {
        printf("+");
        for(int i=0; i<n; i++)
        {
            printf("-");
        }
        printf("+\n");

        for(int i=0; i<m; i++)
        {
            printf("|");
            for(int i=0; i<n; i++)
                printf(" ");
            printf("|\n");
        }

        printf("+");
        for(int i=0; i<n; i++)
        {
            printf("-");
        }
        printf("+\n");
        printf("\n");
    }


    return 0;
}

2053:

#include <cstdio>
using namespace std;

int main()
{
    int n;
    while(scanf("%d", &n) != EOF)
    {
        int cnt = 0;
        for(int i=1; i<=n; i++)
        {
            if(n%i ==0)
                cnt ++;
        }
        if(cnt%2 == 0)
            printf("0\n");
        else
        {
                printf("1\n");
        }
        
    }


    return 0;
}

2054:

#include <cstdio>
#include <cstring>
using namespace std;

char str1[100000+7];
char str2[100000+7];

int main()
{
    while(scanf("%s%s", str1, str2) != EOF)
    {
        int len1 = strlen(str1);
        int len2 = strlen(str2);
        int index1 = 0;
        int index2 = 0;
        bool flag1 = 0;
        bool flag2 = 0;

        for(int i=0; i<len1; i++)   // 寻找小数点,并记录位置
        {
            if(str1[i] == '.')
            {
                flag1 = 1;
                break;
            }       
            index1 ++;
        }
        for(int i=0; i<len2; i++)   
        {
            if(str2[i] == '.')
            {
                flag2 = 1;
                break;
            }
            index2 ++;
        }

        if(flag1)   // 如果是一个浮点数,则去掉后缀0,如果是1.000这样的还要去掉小数点
        {
            int i;
            for(i=len1-1; str1[i] == '0'; i--)
            {
                str1[i] = '\0';
            }
            // printf("%d\n", i);
            if(str1[i] == '.')
                str1[i] = '\0';
        }
        if(flag2)
        {
            int i;
            for(i=len2-1; str2[i] == '0'; i--)
            {
                str2[i] = '\0';
            }
            if(str2[i] == '.')
                str2[i] = '\0';
        }
        // printf("%s %s\n", str1, str2);
        if(strcmp(str1, str2) == 0)
            printf("YES\n");
        else
        {
                printf("NO\n");
        }
        
    }


    return 0;
}

2055:

#include <cstdio>
#include <map>

using namespace std;
map<char, int> ma;

void init()
{
    ma.clear();
    int cnt = -1;
    for(int i='a'; i<='z'; i++)
    {
        ma[i] = cnt--;
    }
    cnt = 1;
    for(int i='A'; i<='Z'; i++)
    {
        ma[i] = cnt++;
    }
}
int main()
{
    init();
    int t;
    scanf("%d", &t);
    getchar();
    while(t--)
    {
        char ch;
        int y;
        scanf("%c %d", &ch, &y);
        getchar();
        printf("%d\n", ma[ch] + y);
    }

    return 0;
}

2056:

#include <cstdio>

using namespace std;
void trans(double &a, double &b)
{
    double tmp = a;
    a = b;
    b = tmp;
}

int main()
{
    double x1, y1, x2, y2, x3, y3, x4, y4;
    while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4) != EOF)
    {
        if(x1 > x2) trans(x1, x2);
        if(x3 > x4) trans(x3, x4);
        if(y1 > y2) trans(y1, y2);
        if(y3 > y4) trans(y3, y4);

        double minx = x1 > x3 ? x1 : x3;
        double maxx = x2 < x4 ? x2 : x4;
        double miny = y1 > y3 ? y1 : y3;
        double maxy = y2 < y4 ? y2 : y4;

        if(minx > maxx || miny > maxy)
            printf("0.00\n");
        else
        {
            printf("%.2lf\n", (maxx - minx) * (maxy - miny));
        }
        
    }


    return 0;
}

2057:

#include <cstdio>
#include <iostream>
#include <string>
#include <stack>

using namespace std;
typedef long long LL;

LL pow16(int n) // 返回16的n次幂
{
    LL res = 1;
    for(int i=0; i<n; i++)
        res = res * 16;
    return res;
}

LL fun1(string str)  // 十六进制转成十进制
{
    LL res = 0;
    int cnt = 0;
    for(int i=str.size()-1; i>0; i--)
    {
        if(str[i] == 'A')
            res += 10 * pow16(cnt++);
        else if(str[i] == 'B')
            res += 11 * pow16(cnt++);
        else if(str[i] == 'C')
            res += 12 * pow16(cnt++);
        else if(str[i] == 'D')
            res += 13 * pow16(cnt++);
        else if(str[i] == 'E')
            res += 14 * pow16(cnt++);
        else if(str[i] == 'F')
            res += 15 * pow16(cnt++);
        else
        {
            res += (str[i] - '0') * pow16(cnt++);
        }
    }
    if(str[0] == '-')   // 判断是否带符号
        res = -res;
    else if(str[0] != '-' && str[0] != '+')
    {
        if(str[0] == 'A')
            res += 10 * pow16(cnt++);
        else if(str[0] == 'B')
            res += 11 * pow16(cnt++);
        else if(str[0] == 'C')
            res += 12 * pow16(cnt++);
        else if(str[0] == 'D')
            res += 13 * pow16(cnt++);
        else if(str[0] == 'E')
            res += 14 * pow16(cnt++);
        else if(str[0] == 'F')
            res += 15 * pow16(cnt++);
        else
        {
            res += (str[0] - '0') * pow16(cnt++);
        }
    }
    return res;
}

stack<int> s;   // 保存二进制数
void fun2(LL num)   // 十进制转二进制
{
    if(num < 0) num = -num; // 转换期间不考虑符号
    while(!s.empty()) s.pop();
    do{
        s.push(num%2);
        num /= 2;
    }while(num);
    int len = s.size();
    while(s.size() % 4 != 0)    // 不是4的整数倍,添加前导0
        s.push(0);
}

int main()
{
    ios::sync_with_stdio(0);
    string a, b;
    while(cin >> a >> b)
    {
        LL sum = fun1(a) + fun1(b); // 先转化为10进制,然后求和
        fun2(sum);      // 转化为二进制,先不考虑符号
        
        if(sum < 0) printf("-");
        while(!s.empty())       // 二进制转16进制
        {
            int x1 = s.top();   s.pop();
            int x2 = s.top();   s.pop();
            int x3 = s.top();   s.pop();
            int x4 = s.top();   s.pop();
            int ans = x4 + x3*2 + x2*2*2 + x1*2*2*2;
            if(ans == 10)   printf("A");
            else if(ans == 11)  printf("B");
            else if(ans == 12)  printf("C");
            else if(ans == 13)  printf("D");
            else if(ans == 14)  printf("E");
            else if(ans == 15)  printf("F");
            else
            {
                printf("%d", ans);
            }
        }
        printf("\n");

    }
    

    return 0;
}

// #include <cstdio>
// using namespace std;
// typedef long long LL;

// int main()
// {
//     LL a, b;
//     while(scanf("%llX %llX", &a, &b) != EOF)
//     {
//         LL sum = a + b;
//         if(sum < 0)
//         {
//             printf("-");
//             sum = -sum;
//         }
            
//         printf("%llX\n", sum);
//     }



//     return 0;
// }

2058:

#include <cstdio>
#include <cmath>

using namespace std;
typedef long long LL;

int main()
{
    LL n, m;
    while(scanf("%lld %lld", &n, &m), n+m) // n, m都不为0
    {
        for(LL d = sqrt(2*m); d>0; d--)
        {
            LL a = (2*m - d*d - d) / (2*d);
            if(2*a*d + d + d*d == 2*m)
            {
                printf("[%lld,%lld]\n", a+1, a+d);
            }
        }
        printf("\n");
    }


    return 0;
}

2059:

#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>

using namespace std;
const int INF = 0x3f3f3f3f;

double dp[100+7];
int dis[100+7]; // 每个充电站到起点的距离

int main()
{
    int l;
    while(scanf("%d", &l) != EOF)
    {
        int n, c, t;    // 充电站的个数,充完电行驶的距离,充电所需时间
        int vr, vt1, vt2; // 兔子的速度,骑车速度,脚蹬速度
        scanf("%d %d %d", &n, &c, &t);
        scanf("%d %d %d", &vr, &vt1, &vt2);

        dis[0] = 0;
        dis[n+1] = l;
        for(int i=1; i<=n; i++)
            scanf("%d", &dis[i]);
        // memset(dp, 0x3f, sizeof(dp)); double类型不能用memset 
        dp[0] = 0;
        for(int i=1; i<107; i++)
            dp[i] = INF;
        
        double tmp;
        for(int i=1; i<=n+1; i++)
        {
            for(int j=0; j<i; j++)
            {
                int len = dis[i] - dis[j];  // 两个充电站之间的距离
                if(len <= c)
                    tmp = 1.0 * len / vt1;
                else
                    tmp = 1.0 * c/vt1 + 1.0 * (len-c) / vt2;
                if(j != 0)
                    tmp += t;
                dp[i] = min(dp[j]+tmp, dp[i]);
            }
        }
        double tr = 1.0 * l /vr;    // 兔子所用时间
        if(dp[n+1] > tr)
            printf("Good job,rabbit!\n");
        else
            printf("What a pity rabbit!\n");
    }


    return 0;
}