Life is short, so we need program

每日一题, 积累从点滴开始

  :: 首页 :: 博问 :: 闪存 :: :: 联系 :: :: 管理 ::

 

做题地址:http://acm.hdu.edu.cn/diy/contest_login.php?cid=16582

 

杭电1089-1096 http://acm.hdu.edu.cn/listproblem.php?vol=1

 

 

主要考点是输入输出,以下全部是C代码。

HDU1089

#include <stdio.h>
int main()
{
    int a, b;
    while(scanf("%d%d", &a, &b) != EOF)
    {
        printf("%d\n", a+b);
    }
    return 0;
}

 

HDU1090

#include <stdio.h>
int main()
{
    int a, b, i;
    scanf("%d", &i);
    while(i--)
    {
        scanf("%d%d", &a, &b);
        printf("%d\n", a+b);
    }
    return 0;
}

 

HDU1091

#include <stdio.h>
int main()
{
    int a, b;
    while(1)
    {
        scanf("%d%d", &a, &b);
        if(a==0 && b==0)
            break;
        printf("%d\n", a+b);
    }
    return 0;
}

 

HDU1092

#include <stdio.h>
int main()
{
    int a, s, t;
    while(1)
    {
        scanf("%d", &a);
        if(a==0)
            break;
        for(s=0;a--;)
        {
            scanf("%d", &t);
            s+=t;
        }
        printf("%d\n", s);
    }
    return 0;
}

 

 

HDU1093

#include <stdio.h>
int main()
{
    int a, b, s, t;
    scanf("%d", &b);
    while(b--)
    {
        scanf("%d", &a);
        for(s=0;a--;)
        {
            scanf("%d", &t);
            s+=t;
        }
        printf("%d\n", s);
    }
    return 0;
}

 

 

 

HDU1094

#include <stdio.h>
int main()
{
    int a, b, s, t;
    while(scanf("%d", &a) != EOF)
    {
        for(s=0;a--;)
        {
            scanf("%d", &t);
            s+=t;
        }
        printf("%d\n", s);
    }
    return 0;
}

 

 

 

HDU1095

#include<stdio.h>
int main()
{
    int a,b,sum;
    while((scanf("%d %d",&a,&b))!=EOF)
    {
        sum=0;
        sum=a+b;
        printf("%d\n",sum);
        printf("\n");
    }
    return 0;
}

 

 

HDU1096

#include <stdio.h>
int main()
{
    int a, b, s, t;
    scanf("%d", &b);
    while(b--)
    {
        scanf("%d", &a);
        for(s=0; a--; )
        {
            scanf("%d", &t);
            s+=t;
        }
        printf("%d\n", s);
        if(b)
            puts("");
    }
    return 0;
}

 

posted on 2012-08-10 18:53  CDU_ICPC  阅读(226)  评论(0编辑  收藏  举报