(URI) Distância - Solução
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int distancia = leitor(br);
System.out.println((distancia+distancia) + " minutos");
}
static int leitor(BufferedReader br) throws NumberFormatException, IOException {
int n;
int resp = 0;
while (true) {
n = br.read();
if (n >= '0' && n <= '9')
break;
}
while (true) {
resp = resp*10 + n-'0';
n = br.read();
if (n < '0' || n > '9')
break;
}
return resp;
}
}
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int distancia = leitor(br);
System.out.println((distancia+distancia) + " minutos");
}
static int leitor(BufferedReader br) throws NumberFormatException, IOException {
int n;
int resp = 0;
while (true) {
n = br.read();
if (n >= '0' && n <= '9')
break;
}
while (true) {
resp = resp*10 + n-'0';
n = br.read();
if (n < '0' || n > '9')
break;
}
return resp;
}
}
Comments
Post a Comment