题目链接
#include<iostream>
using namespace std;
int main() {
int n, a, b;
while (cin >> n) {
while (n--) {
cin >> a >> b;
cout << a + b << endl;
}
}
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
while (scanner.hasNext()) {
int n = scanner.nextInt();
while (n-- > 0) {
int a = scanner.nextInt();
int b = scanner.nextInt();
System.out.println(a + b);
}
}
}
}
while 1:
try:
N = int(input())
for i in range(N):
l = list(map(int,input().split()))
print(sum(l))
except:
break
package main
import "fmt"
func main() {
var n, a, b int
for {
_, err := fmt.Scan(&n)
if err != nil {
break
}
for n > 0 {
_, err := fmt.Scan(&a, &b)
if err != nil {
break
}
fmt.Println(a + b)
n--
}
}
}
// 引入readline模块来读取标准输入
const readline = require("readline");
// 创建readline接口
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
function processInput() {
let pathArr = [];
rl.on("line", (input) => {
let path = input.split(" ").map(Number);
// 将输入转为数组,根据length属性判断输入数字的个数
if (path.length == 1) {
pathArr.push(path);
} else {
const [a, b] = path
const sum = a + b;
console.log(sum);
}
});
}
processInput();
#include <stdio.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d\n",a+b);
}
}
return 0;
}