首页 > 试题广场 >

多组_A+B_零尾模式

[编程题]多组_A+B_零尾模式
  • 热度指数:24180 时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
给定若干组测试数据,最后一组数据为 0\ 0 ,作为输入的结尾。
每组数据有两个整数 ab ,请你求出 a+b 的值。

输入描述:
每行有两个整数 a\ (\ 0 \leq a \leq 10^9\ )b\ (\ 0 \leq b \leq 10^9\ )
最后一组数据为 0\ 0 ,作为输入的结尾。


输出描述:
输出若干行,每行一个整数,代表 a+b 的值。
示例1

输入

1 2
114 514
2024 727
0 0

输出

3
628
2751
头像 张_顺飞
发表于 2024-11-08 20:39:15
while(True): a,b = map(int,input().split()) if a|b: print(a+b) else: break
头像 hellodayan
发表于 2024-08-21 20:59:43
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); 展开全文
头像 牛客688741001号
发表于 2024-12-12 15:11:39
while True: # 读取一行输入,并尝试将其分割为两个整数 try: a, b = map(int, input().strip().split()) # 检查是否遇到了结束标记 if a == 0 and b == 0: 展开全文
头像 Silencer76
发表于 2024-12-11 15:46:28
解题思路 使用 while 循环重复输入 代码 c++ java python #include <iostream> using namespace std; int main(void) { ios::sync_with_stdio(false); cin.ti 展开全文
头像 还不可以认输
发表于 2025-11-09 13:46:40
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = 展开全文
头像 hxsty
发表于 2025-05-15 14:10:27
#include <stdio.h> int main() { int a, b; while(scanf("%d %d",&a,&b)!=EOF) { if(a==0&&b==0) 展开全文
头像 美丽的突尼斯海怪面向对象
发表于 2024-11-10 12:41:16
import sys for line in sys.stdin: a = list(map(int,line.split())) if len(a) == 2 and a[0] == 0 and a[1] == 0: pass else: 展开全文
头像 牛客752200376号
发表于 2025-03-04 11:24:42
#include <stdio.h> int main() { int a, b; int t; while (scanf("%d %d", &a, &b) != EOF) { if (a == 0 展开全文
头像 克里里克kliric
发表于 2024-11-27 23:57:35
#include <stdio.h> int main() { int a, b; while (scanf("%d %d", &a, &b) != EOF) { // 多组输入 if(a+b==0)//最后一组数据为 展开全文