import java.util.Scanner;
public class saida {
public static void
main(String[] args) {
Scanner input = new Scanner (System.in);
int qtd =
input.nextInt();
int soma = 0, passos = 1;
for (int i = 1; i < qtd;
i++){
soma = soma + passos;
passos++;
soma = soma +
passos;
passos++;
}
soma = soma + passos++;
System.out.print(soma +"
");
soma =soma + passos;
System.out.print(soma + " ");
}
}
disco.java
import java.util.Scanner;
public class setores {
public static void
main(String[] args) {
// TODO setores do disco
Scanner input = new Scanner
(System.in);
int trilhas = input.nextInt();
int pulo =
input.nextInt();
int [] vetor = new int[trilhas];
int p = 0;
for (int i
= 1; i <= trilhas; i++){
vetor[p] = i;
p = p + pulo;
if (p >
trilhas){
p = p - trilhas;
}
}
for (int i = 0; i < trilhas;
i++){
System.out.print(vetor[i] + ", ");
}
}
}
reis.java
/*feito pelo time wae William, Alisson e Erick**/
import java.util.Scanner;
public class reis {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int l; l = input.nextInt();
int c;
c = input.nextInt();
int x;
while (l != 0 c != 0) {
if (l > 10000 c > 10000){
System.out.println("acima do limite");
}
else {
l = (l + 1) / 2;
c = (c + 1) / 2;
x = l * c;
System.out.println(x);
}
l = input.nextInt();
c = input.nextInt();
}
}
}
Nenhum comentário:
Postar um comentário