-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP191.java
More file actions
25 lines (24 loc) · 746 Bytes
/
P191.java
File metadata and controls
25 lines (24 loc) · 746 Bytes
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
package buclesSimples;
import java.util.Scanner;
//accepted
public class P191 {
static int tamanioAcuario(int compartimentos, int mayor, int diferencia){
int resultado = 0;
for (int i = 0; i < compartimentos; i++) {
resultado=resultado+mayor;
mayor=mayor-diferencia;
}
return resultado;
}
public static void main(String[] args) {
Scanner scN = new Scanner(System.in);
Scanner scL = new Scanner(System.in);
int casos = scN.nextInt();
for (int i = 0; i < casos; i++) {
int a = scN.nextInt();
int b = scN.nextInt();
int c = scN.nextInt();
System.out.println(tamanioAcuario(a,b,c));
}
}
}