DO NOT: Square Sum
DO NOT: Square Sum
DO NOT: Square Sum
T
T
NO
BU
Square Sum
Jojo gives Lili a question. In the question, Jojo will give Lili a 4x4 square which is
described below.
I
b/2 c/3 d/4 c/3
R
c/3 d/4 c/3 b/2
O
d/4 c/3 b/2 a/1
2, 3, 4 respectively. Calculate the total sum of the square. Unfortunately, Lili cannot
answer Jojo’s question correctly. Help Lili by making a program that will help her to
S
answer Jojo’s question correctly.
Format Input
DI
Format Output
OT
UT
RE
The output consists of 3 lines. Each line consists of total sum with 2 decimal points.
Constraints
0 ≤ a, b, c, d ≤ 100 (The value of each variable always lie between 0 and 100)
N
IB
Sample Input (standard input)
0 0 0 0
1 2 3 4
TR
DO
2 4 9 16
16.00
46.00
ED
© School of Computer Science - BINUS, 2021. 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.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming
T
T
Explanation
NO
BU
On the second line, the variable a = 1, b = 2, c = 3, d = 4. Therefore, the square is
I
So the value in square is equal to
R
O
1 1 1 1
1 1 1 1
1 1 1 1
T
D
1 1 1 1
OT
UT
RE
N
IB
TR
DO
IS
ED
© School of Computer Science - BINUS, 2021. 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.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming
T
T
NO
BU
Square Sum
Jojo memberikan Lili sebuah soal. Di soal tersebut, Jojo akan memberikan Lili sebuah
kotak berukuran 4x4 seperti berikut:
I
b/2 c/3 d/4 c/3
R
O
c/3 d/4 c/3 b/2
d/4 c/3 b/2 a/1
T
Diberikan sebuah bilangan bulat positif a, b, c dan d. Bilangan b, c dan d tidak dipastikan
D
dapat dibagi habis dengan 2, 3, 4, dst. Hitunglah jumlah total dari kotak tersebut. Lili
tidak dapat menjawab soal Jojo. Lili akhirnya meminta bantuan Anda untuk membuat
S
sebuah program yang dapat memberikan jawaban dari soal Jojo dengan benar.
Format Input
DI
Input terdiri dari 3 baris. Setiap baris terdiri dari 4 bilangan bulat positif.
Format Output
OT
UT
RE
Output terdiri dari 3 baris. Setiap baris terdiri dari jawaban berupa bilangan dengan 2
angka dibelakang koma.
Constraints
N
0 ≤ a, b, c, d ≤ 100
IB
Sample Input (standard input)
0 0 0 0
TR
DO
1 2 3 4
2 4 9 16
0.00
16.00
46.00
ED
© School of Computer Science - BINUS, 2021. 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.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming
T
T
Explanation
NO
BU
Pada baris kedua, a = 1, b = 2, c = 3, d = 4. Kotak tersebut merupakan
I
Nilai dari kotak tersebut adalah
R
O
1 1 1 1
1 1 1 1
1 1 1 1
T
D
1 1 1 1
OT
UT
RE
N
IB
TR
DO
IS
ED
© School of Computer Science - BINUS, 2021. 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.
Violators of this clause may be academically sanctioned.