Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

COMP6047 – Algorithm and Programming

Math Homeworks
Today Jojo has a special guest at his house. His very naughty cousin came to stay at
Jojo’s house for 1 week. During the same week, Jojo took his cousin to her school. On
Wednesday, his cousin got a math homework that had to be collected the next day. Jojo’s
cousin asked Jojo for help. However, they do not want to spend much time doing the
homework, since they have purchased tickets to watch their favorite movie. Help them
solve it quickly.

Format Input
There are 3 lines of input with format “(A + B)x(C − D)” for each line.

Format Output
One line that contains 3 numbers that is the result of the input of each row.

Constraints

• 1 ≤ A, B, C, D ≤ 200.000

Sample Input (standard input)


(1+2) x (3 -4)
(10+3) x (5 -2)
(9+21) x (45 -20)

Sample Output (standard output)


-3 69 750

Note
Input doesn’t contain any space character

c School of Computer Science - BINUS, 2020. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
For those who violated this disclaimer, academic sanctioned can be enforced.
COMP6047 – Algorithm and Programming

Math Homeworks
Hari ini Jojo mendapat tamu spesial di rumahnya. Adik sepupunya yang sangat nakal
datang untuk menginap di rumah Jojo selama 1 minggu. Selama 1 minggu itu pula,
Jojo mengantarkan adik sepupunya ke sekolah. Pada hari Rabu, adik sepupunya menda-
pat PR matematika yang harus dikumpulkan esok harinya. Adik sepupu Jojo meminta
bantuan Jojo untuk mengerjakannya. Namun, Mereka tidak ingin menghabiskan banyak
waktu untuk mengerjakan PR tersebut, sebab mereka telah membeli tiket menonton film
favorit mereka. Bantulah mereka menyelesaikannya dengan cepat.

Format Input
Terdapat 3 baris input dengan format “(A + B)x(C − D)” setiap barisnya.

Format Output
Sebuah baris yang berisi 3 buah bilangan yang merupakan hasil input setiap barisnya.

Constraints

• 1 ≤ A, B, C, D ≤ 200.000

Sample Input (standard input)


(1+2) x (3 -4)
(10+3) x (5 -2)
(9+21) x (45 -20)

Sample Output (standard output)


-3 69 750

Note
Input tidak mengandung karakter spasi

c School of Computer Science - BINUS, 2020. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
For those who violated this disclaimer, academic sanctioned can be enforced.

You might also like