From cd497f864e490023bc321566eed4bcd94c4b7bd0 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Sat, 18 Nov 2017 23:20:16 +0100 Subject: Problema 368 resuelto. --- AceptaElReto/src/problemas/Problema368.java | 25 +++++++++++++++++++++++++ AceptaElReto/src/problemas/Problema370.java | 1 + 2 files changed, 26 insertions(+) create mode 100644 AceptaElReto/src/problemas/Problema368.java diff --git a/AceptaElReto/src/problemas/Problema368.java b/AceptaElReto/src/problemas/Problema368.java new file mode 100644 index 0000000..8a7f418 --- /dev/null +++ b/AceptaElReto/src/problemas/Problema368.java @@ -0,0 +1,25 @@ +package problemas; + +public class Problema368 { + + static java.util.Scanner in; + + public static void main(String args[]) { + in = new java.util.Scanner(System.in); + + int huevos = in.nextInt(); + int olla = in.nextInt(); + while ( huevos != 0 ) { + System.out.println(casoDePrueba(huevos, olla)); + huevos = in.nextInt(); + olla = in.nextInt(); + } + } + + public static int casoDePrueba(int huevos, int olla) { + if ( huevos % olla != 0 ) { + return ( huevos / olla + 1 ) * 10; + } + return ( huevos / olla ) * 10; + } +} diff --git a/AceptaElReto/src/problemas/Problema370.java b/AceptaElReto/src/problemas/Problema370.java index 48c5dce..1673b29 100644 --- a/AceptaElReto/src/problemas/Problema370.java +++ b/AceptaElReto/src/problemas/Problema370.java @@ -13,6 +13,7 @@ public class Problema370 { System.out.println(casoDePrueba(llave)); } } + public static String casoDePrueba(String llave) { int calibreUno = Integer.parseInt(llave.substring(0, llave.indexOf('-'))); int calibreDos = Integer.parseInt(llave.substring(llave.indexOf('-') + 1)); -- cgit v1.2.1