Blog·Tanky WooABOUTRSS

HDOJ 2000~2010 水题1

14 Jul 2010
这篇博客是从旧博客 WordPress 迁移过来,内容可能存在转换异常。

累了拿水题做做也是8错的。

HDOJ2000~2100号称是最简单最简单的了。

做了。先发前10题代码:

 #include 
#include 
using namespace std;

//HDOJ 2000
/*
int main()
{
    char a, b, c, temp;
    while(scanf("%c %c %c", &a;, &b;, &c;) != EOF)
    {
        if(a > b)
        {
            temp = a;
            a = b;
            b = temp;
        }
        if(c < b)
        {
            temp = c;
            c = b;
            b = temp;
        }
                if(a > b)
        {
            temp = a;
            a = b;
            b = temp;
        }
        printf("%c %c %c\n", a, b, c);
        getchar();

    }
    return 0;
}
*/

//HDOJ 2001
/*
int main()
{
    double x1, y1, x2, y2;
    while(scanf("%lf %lf %lf %lf", &x1;, &y1;, &x2;, &y2;) != EOF)
        printf("%.2lf\n", sqrt((double)((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))));
    return 0;
}
*/

//HDOJ 2002
/*
#define PI 3.1415927
double R;
int main()
{
    while(scanf("%lf", &R;) != EOF)
        printf("%.3lf\n", 4.0/3*PI*R*R*R);
    return 0;
}
*/

//HDPJ 2003
/*
int main()
{
    double m;
    while(scanf("%lf", &m;) != EOF)
        printf("%.2lf\n", fabs(m));
    return 0;
}
*/


// HDOJ 2004
/*
int main()
{
    int t;
    while(scanf("%d", &t;) != EOF)
    {
        if(t >= 0 && t <= 59)
            printf("E\n");
        else if(t >= 60 && t <= 69)
            printf("D\n");
        else if(t >= 70 && t <= 79)
            printf("C\n");
        else if(t >= 80 && t <= 89)
            printf("B\n");
        else if(t >= 90 && t <= 100)
            printf("A\n");
        else printf("Score is error!\n");
    }
    return 0;
}
*/

// HDOJ 2005
/*
int MONTH[2][13] = \{\{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, 
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31\}\};

bool IsLeap(int n)
{
    if((n % 4 == 0 && n % 100) || n % 400 == 0)
        return 1;
    else
        return 0;
}
int main()
{
    int year, month, day;
    char a, b;
    while(scanf("%d%c%d%c%d", &year;, &a;, &month;, &b;, &day;) != EOF)
    {
        int tot = 0;
        bool flag = IsLeap(year);
        for(int i = 1; i < month; ++i)
            tot += MONTH[flag][i];
        tot += day;
        printf("%d\n", tot);

        //printf("%d %d %d\n", year, month, day);
    }
    return 0;


}
*/


// HDOJ 2006
/*
int main()
{
    int m, n;\
    while(scanf("%d", &n;) != EOF)
    {
        int tot = 1;
        for(int i = 0; i < n; ++i)
        {
            scanf("%d", &m;);
            if(m % 2)
                tot *= m;
        }
        printf("%d\n", tot);
    }
    return 0;
}
*/


// HDOJ 2007
// WA了2次,在网上查了下才知道,给出的范围没说第一个一定比第二个小。
// 算是自己看题不仔细吧,思维不严谨,呵呵。
/*
int main()
{
    long odd, even;
    int m, n;
    int t;
    while(scanf("%d %d", &m;, &n;) != EOF)
    {
        if(m > n)
        {
            m += n;
            n = m-n;
            m -= n; 
        }
        even = 0;
        odd = 0;
        for(int i= m; i <= n; ++i)
        {
            if(i % 2)
                odd += i*i*i;
            else
                even += i*i;
        }
        printf("%ld %ld\n", even, odd);
    }
    return 0;
}
*/

// HDOJ 2008
/*
int negative, zero, positive;

int n;
double num;
int main()
{
    while(scanf("%d", &n;) != EOF && n)
    {
        negative = 0;
        zero = 0;
        positive = 0;
        for(int i = 0; i < n; ++i)
        {
            scanf("%lf", &num;);
            if(num >0)
                positive++;
            else if(fabs(num-0.0) < 1e-6)
                zero++;
            else
                negative++;
        }
        printf("%d %d %d\n", negative, zero, positive);
    }
    return 0;
}
*/


// HDOJ 2009
/*
int m, n;
int main()
{
    while(scanf("%d %d", &n;, &m;) != EOF)
    {
        double tot = 0.0, temp;
        temp = (double)n;
        for(int i = 0; i < m; ++i)
        {
            tot += temp;
            temp = sqrt((double)temp);
        }
        printf("%.2lf\n", tot);
    }
    return 0;
}
*/

// HDOJ 2010
// 此题经验证输出数的最后一位不能多一个空格

/*
bool Is(int n)
{
    int a, b, c;
    a = n / 100;
    b = n % 100 /10;
    c = n % 10;
    if(n == a*a*a + b*b*b + c*c*c)
        return 1;
    else 
        return 0;
}
int m, n;
int main()
{
    while(scanf("%d %d", &m;, &n;) != EOF)
    {
        int flag = 0, is_first = 1;
        for(int i = m; i <= n; ++i)
            if(Is(i))
            {
                if(is_first)
                {
                    printf("%d", i);
                    is_first = 0;
                }
                else 
                    printf(" %d", i);
                flag = 1;
            }
        if(flag == 0)
            printf("no");
        printf("\n");
    }
    return 0;
}
*/