+ 2

¿Necesito resolver todos los casos de prueba a la vez?

Porque cuando hago bien uno me dice que el otro está mal. En caso afirmativo, yo que estoy en JavaScript, como hago para mostrar 2 console log por separado, pues se me junta el resultado. En caso negativo ¿cómo hago para desbloquear los casos de prueba con cadena?

4th Apr 2021, 12:28 PM
Jorge Vasquez
Jorge Vasquez - avatar
47 Antworten
+ 3
True, I'm stupid xd
4th Apr 2021, 7:34 PM
Jorge Vasquez
Jorge Vasquez - avatar
+ 1
Hola! sí, necesita escribir un programa a la vez para todos los casos de prueba a la vez. debe ser universal. como un programa de Calculadora que puede producir todas las acciones con números desconocidos para ella
4th Apr 2021, 12:40 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
retire la variable "pantalones" y use la variable "oldPrice". no es necesario sustituir valores rectos. el programa reemplazará automáticamente los necesarios
4th Apr 2021, 12:47 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
oldPrice is your input data. the test program inserts the data there automatically. in fact, you only need to finish writing this program. it has already begun. it's like being asked to write a calculator program where you have to provide for two variables whose values you don't initially know
4th Apr 2021, 1:08 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
+ 1
Thanks you!! :)
4th Apr 2021, 1:14 PM
Jorge Vasquez
Jorge Vasquez - avatar
+ 1
Break for dinner teacher
4th Apr 2021, 7:13 PM
Jorge Vasquez
Jorge Vasquez - avatar
+ 1
//para no abrumarte, hemos escondido el código que ejecuta la entrada function main() { var oldPrice = parseInt(readLine(), 10) // tu código va aquí var discount = 0.20; console.log(oldPrice - (0.20 * oldPrice)); } AAAAAAA I OBTAIN
4th Apr 2021, 7:31 PM
Jorge Vasquez
Jorge Vasquez - avatar
+ 1
Love you man sorry for the time spent jajajaja
4th Apr 2021, 7:32 PM
Jorge Vasquez
Jorge Vasquez - avatar
+ 1
I'm sick in bed today, so you've been entertaining me.
4th Apr 2021, 7:36 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Mi código. Ejercicio 7.3 de JavaScript function main() { var oldPrice = parseInt(readLine(), 10) // tu código va aquí var descuento = 20/100; var pantalones = 150; console.log(pantalones - (pantalones * descuento)) var camiseta = 100; console.log(camiseta - (camiseta * descuento)) var bolso = 1500; console.log(bolso - (bolso * descuento)); } El resultado me da = 120 80 1200 (bien) Pero en un mismo caso de prueba. Por lo que me lo pone mal.
4th Apr 2021, 12:33 PM
Jorge Vasquez
Jorge Vasquez - avatar
0
I dont understand the oldPrice variable :( And your second answer neither, what mean rect value? (You can write in English if you want)
4th Apr 2021, 1:03 PM
Jorge Vasquez
Jorge Vasquez - avatar
0
in oldPrice the test program will put both the pantalones value for the first time and the camiseta value for the second time
4th Apr 2021, 1:12 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
rectos - I was trying to say that there is no need to substitute, assign direct values to a variable and formula. the program must be universal for all values
4th Apr 2021, 1:17 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Can you give me an example to how should I do it?
4th Apr 2021, 2:30 PM
Jorge Vasquez
Jorge Vasquez - avatar
0
you should delete the last 4 lines of your code, then use the oldPrice variable instead of the pantalones variable
4th Apr 2021, 4:04 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
The parseInt() function takes a string as an argument and returns an integer according to the specified base of the number system. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
4th Apr 2021, 4:19 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
pantalones, camiseta, bolso - all of these variables you created are replaced by the oldPrice variable. the following values are written to this variable in turn: 150, 100, 1500 hint: if you are solving this kind of task, you should definitely use the already created variables in your code
4th Apr 2021, 4:25 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
did you succeed or not?
4th Apr 2021, 5:06 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
Negative. And console.log? I need to use it? Just need an example and i think i could do it.
4th Apr 2021, 6:35 PM
Jorge Vasquez
Jorge Vasquez - avatar
0
Yes
4th Apr 2021, 6:35 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar