(UVA) 10696 - f91 - Solução
import java.io.*;
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.processa();
System.exit(0);
}
static long gambis(BufferedReader br) throws NumberFormatException, IOException {
long n;
long 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;
}
void processa() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
long valor = gambis(br);
while (valor > 0) {
long resultado = 0;
if (valor <= 100) {
resultado = 91;
}
else {
resultado = valor-10;
}
bw.write("f91(" + valor + ") = " + resultado + "\n");
bw.flush();
valor = gambis(br);
}
bw.close();
return;
}
}
import java.util.*;
class Main {
public static void main(String[] args) throws NumberFormatException, IOException {
Main processando = new Main();
processando.processa();
System.exit(0);
}
static long gambis(BufferedReader br) throws NumberFormatException, IOException {
long n;
long 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;
}
void processa() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
long valor = gambis(br);
while (valor > 0) {
long resultado = 0;
if (valor <= 100) {
resultado = 91;
}
else {
resultado = valor-10;
}
bw.write("f91(" + valor + ") = " + resultado + "\n");
bw.flush();
valor = gambis(br);
}
bw.close();
return;
}
}
Comments
Post a Comment