Skip to content

Commit c1d6b89

Browse files
committed
AB
1 parent 0412147 commit c1d6b89

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package algorithms.sprint0;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import java.util.Scanner;
6+
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
9+
public class AB {
10+
public static void main(String[] args) {
11+
Scanner sc = new Scanner(System.in);
12+
int a = sc.nextInt();
13+
int b = sc.nextInt();
14+
long sum = sum(a, b);
15+
System.out.println(sum);
16+
}
17+
18+
public static long sum(int a, int b) {
19+
return a + b;
20+
}
21+
22+
@Test
23+
public void test() {
24+
assertEquals(5, sum(2, 3));
25+
assertEquals(-1, sum(-2, 1));
26+
}
27+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package algorithms.sprint0;// Java
2+
3+
import java.io.*;
4+
import java.util.Arrays;
5+
import java.util.List;
6+
7+
public class Solution {
8+
public static void main(String[] args) throws IOException {
9+
List<Integer> arr;
10+
try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
11+
int n = Integer.parseInt(reader.readLine().strip());
12+
arr = Arrays.stream(reader.readLine().strip().split(" "))
13+
.map(Integer::parseInt)
14+
.toList();
15+
}
16+
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
17+
for (int i : arr) {
18+
writer.write(String.valueOf(i));
19+
writer.write(" ");
20+
}
21+
writer.flush();
22+
}
23+
24+
}

0 commit comments

Comments
 (0)