地址
http://acm.hdu.edu.cn/showproblem.php?pid=1091
定位
- 输入输出练习
分析
输入输出标准模板
输入:共N+1行,每次测试数据占一行,最后一行以
0 0结束测试。输出:共N行,每次测试结果占一行。
代码
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b;
scanf("%d*c",&a);
scanf("%d*c",&b);
while(!(a == 0 && b == 0))
{
printf("%d\n",a+b);
scanf("%d*c",&a);
scanf("%d*c",&b);
}
return 0;
}
性能
| Exe.Time | Exe.Memory | Code Length | Language |
|---|---|---|---|
| 0MS | 1412K | 263B | c |
总结
循环终止条件
每次循环开始时,检测输入数据,检测到0 0时跳出循环。
Thanks everyone!
本文解析了HDU 1091题目的输入输出练习,介绍了如何使用C语言实现循环读取并处理输入数据,直至遇到特定终止条件00为止。通过示例代码展示了如何正确地进行输入输出操作。
1212

被折叠的 条评论
为什么被折叠?



