2030:

// 一个汉字占两个字符,且汉字的编码不论是高位还是低位都小于0

#include <cstdio>
#include <cstring>

using namespace std;

char str[1000000];

int main()
{
    int n;
    scanf("%d", &n);
    getchar();
    while(n--)
    {
        gets(str);
        int len = strlen(str);
        int cnt = 0;
        for(int i=0; i<len; i++)
        {
            if(str[i] < 0)
                cnt++;
        }
        printf("%d\n", cnt/2);
    }



    return 0;
}

2031:

#include <cstdio>
#include <stack>

using namespace std;

stack<int> s;

void change(int n, int r)
{
    if(n == 0)
    {
        s.push(0);
        return;
    }
    if(n < 0)   // 这里需要修改符号 不然取余会出现负数
        n = -n;
    while(n)
    {
        s.push(n%r);
        n /= r;
    }
}
int main()
{
    int n, r;
    while(scanf("%d %d", &n, &r) != EOF)
    {
        while(!s.empty()) s.pop();
        change(n, r);

        if(n < 0)   
            printf("-");
        while(!s.empty())
        {
            switch(s.top())
            {
                case 10: printf("A"); break;
                case 11: printf("B"); break;
                case 12: printf("C"); break;
                case 13: printf("D"); break;
                case 14: printf("E"); break;
                case 15: printf("F"); break;
                default: printf("%d", s.top());
            }
            s.pop();
        }
        puts("");
    }


    return 0;
}

2032:

#include <cstdio>
using namespace std;

int a[100][100];
int main()
{
    int n;
    while(scanf("%d", &n) != EOF)
    {
        for(int i=0; i<n; i++)
        {
            a[i][0] = 1;
            a[i][i] = 1;
        }
        for(int i=0; i<n; i++)
        {
            for(int j=1; j<i; j++)
            {
                a[i][j] = a[i-1][j-1] + a[i-1][j];
            }
        }
        for(int i=0; i<n; i++)
        {
            printf("%d", a[i][0]);
            for(int j=1; j<=i; j++)
            {
                printf(" %d", a[i][j]);
            }
            printf("\n");
        }
        printf("\n");
    }


    return 0;
}

2033:

#include <cstdio>
using namespace std;

int main()
{
    int ah, am, as;
    int bh, bm, bs;
    int ans[3];
    int t;
    scanf("%d", &t);
    while(t--)
    {
        scanf("%d %d %d", &ah, &am, &as);
        scanf("%d %d %d", &bh, &bm, &bs);
        int tmp = (as + bs) / 60;
        ans[2] = (as + bs) % 60;
        int tmp2 = (am + bm + tmp) / 60;
        ans[1] = (am + bm + tmp) % 60;
        ans[0] = ah + bh + tmp2;

        printf("%d %d %d\n", ans[0], ans[1], ans[2]);
    }



    return 0;
}

2034:

/* 在集合A中去除B中的元素,然后排序输出
   因为看题不认真,没看到从小到大输出,理所当然的认为是保持原有的顺序,WA了一发 */

#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;
const int INF = 0x3f3f3f3f;

vector<int> v1;
vector<int> v2;
int main()
{
    int n, m;
    while(scanf("%d %d", &n, &m), n||m)
    {
        int num;
        v1.clear();
        v2.clear();
        for(int i=0; i<n; i++)
        {
            scanf("%d", &num);
            v1.push_back(num);
        }
        for(int i=0; i<m; i++)
        {
            scanf("%d", &num);
            v2.push_back(num);
        }
        

        for(int i=0; i<m; i++)
        {
            for(int j=0; j<n; j++)
            {
                if(v1[j] == v2[i])
                    v1[j] = INF;
            }
        }
        sort(v1.begin(), v1.end());
        bool flag = false;
        for(int i=0; i<n; i++){
            if(v1[i] != INF){
                printf("%d ", v1[i]);
                flag = true;
            }
        }
        if(!flag)
            printf("NULL");
        printf("\n");
    }

    return 0;
}

2035:

// 快速幂

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

LL pow_mod(LL a, LL n, LL mod)
{
    LL res = 1;
    while(n)
    {
        if(n%2 != 0)
        {
            res = res * a % mod;
        }
        a = a * a % mod;
        n = n / 2;
    }
    return res;
}

int main()
{
    LL a, b;
    while(scanf("%lld%lld", &a, &b), a || b)
    {
        printf("%lld\n", pow_mod(a, b, 1000));
    }


    return 0;
}

2036:

/* 把矩形分解成n-2个三角形
用叉乘计算三角形面积带绝对值
但是如果在计算多变型的面积时,就不带绝对值
因为多边形分凹凸的情况,凸的贡献为正,凹的贡献为负 */

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

using namespace std;
typedef long long LL;

struct node{
    int x, y;
};
struct node a[100+7];

int main()
{
    int n;
    while(scanf("%d", &n), n)
    {
        for(int i=0; i<n; i++)
        {
            scanf("%d %d", &a[i].x, &a[i].y);
        }
        double s = 0;
        for(int i=2; i<n; i++)
        {
            int t1x = a[i-1].x - a[0].x;
            int t1y = a[i-1].y - a[0].y;
            int t2x = a[i].x - a[0].x;
            int t2y = a[i].y - a[0].y;
            // s = s + 1.0 * abs(t1x*t2y - t2x*t1y);    
            s = s + 1.0 * (t1x*t2y - t2x*t1y);
        }
        printf("%.1lf\n", s/2);

    }    


    return 0;
}

2037:

// 贪心思想,优先选择结束时间早的

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

struct node {
    int s, e;
};
struct node a[100+7];

bool cmp(node a1, node a2)
{
    if(a1.e == a2.e)
        return a1.s < a2.s;
    return a1.e < a2.e;
}
int main()
{
    int n;
    while(scanf("%d", &n), n)
    {
        for(int i=0; i<n; i++)
        {
            scanf("%d %d", &a[i].s, &a[i].e);
        }
        sort(a, a+n, cmp);
        int ans = 1;
        node e = a[0];
        for(int i=1; i<n; i++)
        {
            if(a[i].s >= e.e)
            {
                e = a[i];
                ans ++;
            }
        }
        printf("%d\n", ans);

    }    


    return 0;
}

2038:

// HDU上没有2038题

2039:

// 较小的两边之和大于最大的边
// 题目说是正数,不是整数,不能用int否则WA

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

int main()
{
    int m;
    scanf("%d", &m);
    while(m--)
    {
        double a[3];
        scanf("%lf %lf %lf", &a[0], &a[1], &a[2]);
        sort(a, a+3);
        if(a[0] + a[1] > a[2])
            printf("YES\n");
        else
            printf("NO\n");

    }


    return 0;
}