-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp121.java
36 lines (27 loc) · 1.26 KB
/
p121.java
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
26
27
28
29
30
31
32
33
34
35
36
package com.caiomed03.aceptaelreto;
import java.util.Scanner;
public class p121 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int envoltoriosParaChicle;
int chiclePorEnvoltorio;
int cantidadEnvoltorios;
envoltoriosParaChicle = sc.nextInt();
chiclePorEnvoltorio = sc.nextInt();
cantidadEnvoltorios = sc.nextInt();
while (!(envoltoriosParaChicle == 0 && chiclePorEnvoltorio == 0 && cantidadEnvoltorios == 0)) {
int chiclesASumar = cantidadEnvoltorios / envoltoriosParaChicle * chiclePorEnvoltorio;
if (chiclePorEnvoltorio >= envoltoriosParaChicle) {
System.out.println("RUINA");
} else if (chiclesASumar % envoltoriosParaChicle == 0) {
chiclesASumar += 1;
System.out.println(chiclesASumar + cantidadEnvoltorios + " " + (chiclesASumar + cantidadEnvoltorios) % envoltoriosParaChicle);
} else {
System.out.println(chiclesASumar + cantidadEnvoltorios + " " + chiclesASumar % envoltoriosParaChicle);
}
envoltoriosParaChicle = sc.nextInt();
chiclePorEnvoltorio = sc.nextInt();
cantidadEnvoltorios = sc.nextInt();
}
}
}