(SPOJ) 8777 - Cometa - 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);
}
void processa() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int valor = Integer.parseInt(br.readLine());
int ano;
int i = 1;
do {
ano = 1986 + 76*i;
i++;
} while (ano <= valor);
bw.write(ano+"\n");
bw.flush();
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);
}
void processa() throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int valor = Integer.parseInt(br.readLine());
int ano;
int i = 1;
do {
ano = 1986 + 76*i;
i++;
} while (ano <= valor);
bw.write(ano+"\n");
bw.flush();
bw.close();
return;
}
}
Comments
Post a Comment