-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path2146.java
31 lines (26 loc) · 850 Bytes
/
2146.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Locale;
import java.util.Scanner;
/*
*
*/
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
Locale.setDefault(Locale.US);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
/* um objeto BufferedReader e chame o método readLine() até que ele retorne null.
Lembrando que o método readLine() da classe BufferedReader() retorna uma String.
E como no seu exercício você está lidando com um número,
basta converter a String para int.
*/
String linha;
while ((linha = br.readLine()) != null) {
int n = Integer.parseInt(linha);
System.out.println(n-1);
}
sc.close();
}
}