Let's collect it now , Xiaobai must have some knowledge

This paper takes sum as an example

Multi group input , Each input has one line , Includes two integers A, B
Sample Input 1 2 12 24 400 500 Sample Output 3 36 900 import
java.util.Scanner; public class Main { public static void main(String[] args) {
Scanner sc = new Scanner(System.in); while(sc.hasNext()) {
System.out.println(sc.nextInt()+sc.nextInt()); } } }
The first line is the number of groups of data N, From the second line, yes N The group consists of two integers (A and B) Composition data ,A and B Space between , Each group of input occupies a separate line
Sample Input 2 1 2 10 20 Sample Output 3 30 //2 import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner sc = new
Scanner(System.in); int n=sc.nextInt(); while(n-->0) {
System.out.println(sc.nextInt()+sc.nextInt()); } } }
Multiple sets of data : Each group consists of two integers (A and B) constitute ,A and B Space between , Each group of input occupies a separate line . When the input is "0 0" Time , End of input ."0 0" This set of data is not processed .
Sample Input 1 2 3 4 10 20 0 0 Sample Output 3 7 30 //3 import
java.util.Scanner; public class Main { public static void main(String[] args) {
Scanner sc = new Scanner(System.in); while(true) { int a=sc.nextInt(); int
b=sc.nextInt(); if(a==0 && b==0)break; System.out.println(a+b); } } }
The input contains multiple test cases . Each test case contains a positive integer N, Then came the N An integer follows on the same line . When a test case 0 start , Input termination , And this use case does not handle .
Sample Input 3 1 2 4 1 23 5 1 3 5 7 9 0 Sample Output 7 23 25 //4 import
java.util.Scanner; public class Main { public static void main(String[] args) {
Scanner sc = new Scanner(System.in); while(true) { int a=sc.nextInt();
if(a==0)break; int ac=0; while(a-->0)ac+=sc.nextInt(); System.out.println(ac);
} } }
First act N, It's next N Row data . Data per row : Begin with M, Follow closely M number .
Sample Input 2 1 1 2 3 4 Sample Output 1 7 //5 import java.util.Scanner;
public class Main { public static void main(String[] args) { Scanner sc = new
Scanner(System.in); int n=sc.nextInt(); while(n-->0) { int a=sc.nextInt();
if(a==0)break; int ac=0; while(a-->0)ac+=sc.nextInt(); System.out.println(ac);
} } }

Technology
©2020 ioDraw All rights reserved
Swing actual combat Understanding closure about vue in el-date-picker type=daterange The problem of date not echoing Ubuntu 18.04 swap Partition expansion Snake code --c Language Edition visual c++6.0 open 【Golang Basic series 10 】Go language On conditional sentences ifString class —— summary ,String The nature of , Memory resolution , Commonly used APIAdobe Illustrator Publish native support Apple Silicon Test version of the software study java My first class antd table sort