hdoj1091

第一次尝试

#include<stdio.h>
#include<stdlib.h>                                             关于0 0终止输入和这个测试用例不处理,不会

int main()
{
    int a,b;
    do
    {scanf("%d%d",&a,&b);
    printf("%d\n",a+b);
    }
    while(a!=0||b!=0);
    return 0;
}

第二次尝试

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

讨论区

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

时间: 2025-01-14 10:08:37

hdoj1091的相关文章

ACM基础之四种输入类型及常见实现方法

输入_第一类 输入不说明有多少个Input Block,以EOF为结束标志. 例题(HDOJ1089) Problem Description Your task is to Calculate a + b.Too easy?! Of course! I specially designed the problem for acm beginners. You must have found that some problems have the same titles with this on