You are on page 1of 4

E

COMP6047 – Algorithm and Programming

T
T
NO
BU
Mysterious Number
Lili is enjoying her vacation at the North Pole. However, Lili’s relaxed activities are
interrupted by the moans of living things. Because Lili did not like to hear the sound,
Lili tried to find out the origin of the sound and it turned out that the sound came from a
living creature named Yeti! After Lili approached Yeti, Lili found that Yeti is in trouble

I
learning mathematics. Because Lili wants the moans disappear quickly, Lili plan to assist

R
O
Yeti in solving her math problems.

Yeti will tell Lili a number. Then Lili must answer whether these numbers are prime
T
numbers, quadratic numbers or cubic numbers.
D

Format Input
S
There are T test cases. Each testcase contains an integer X which indicates the number
Yeti gave.
DI

Format Output
Output T line with format “Case #X: ”, where X indicates the testcase number starting
OT
UT
at 1 and then followed by “prime” if the number is a prime, and then followed by “square”
RE

if the number is a square, and then followed by “cubic” if the number is a cubic. If none
of these condition satisfied, then output “none”.

Constraints
N
• 1 ≤ T ≤ 20
IB
• 0 ≤ X ≤ 1000000

Sample Input (standard input)


TR
DO

5
64
9
8
2
IS

21
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
Sample Output (standard output)

NO
BU
Case #1 : square cubic
Case #2 : square
Case #3 : cubic
Case #4 : prime
Case #5 : none

R I
O
T
D
S
DI

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
Mysterious Number
Lili sedang menikmati liburannya di kutub Utara. Namun, aktivitas santai Lili diganggu
oleh erangan makhluk hidup. Karena Lili tidak suka mendengar suara tersebut, Lili
mencoba mencari tahu asal suara tersebut dan ternyata suara tersebut berasal dari
makhluk hidup bernama Yeti! Setelah Lili mendekati Yeti tersebut, Lili menemukan

I
bahwa Yeti tersebut sedang kesulitan dalam mempelajari matematika. Karena Lili ingin

R
O
agar suara erangan tersebut cepat menghilang, maka Lili berencana membantu Yeti dalam
menyelesaikan soal matematikanya.
T
Yeti akan memberitahukan suatu angka kepada Lili. Kemudian Lili harus menjawab
D

apakah angka tersebut adalah angka prima, angka kuadrat ataupun angka kubik.
S
Format Input
Terdapat T buah testcase. Setiap testcase berisi satu angka X yang merupakan angka
DI

yang diberikan oleh Yeti

Format Output
OT
UT
Keluarkan T baris dengan format “Case #X: ”, dimana X menandakan nomor testcase
RE

mulai dari 1, kemudian diikuti “prime” apabila angka tersebut adalah angka prima,
kemudian diikuti “square” apabila angka tersebut adalah angka kuadrat, kemudian diikuti
“cubic” apabila angka tersebut adalah angka kubik yang dipisah oleh 1 spasi. Jika bukan
ketiganya keluarkan “none”.
N
IB
Constraints
• 1 ≤ T ≤ 20

• 0 ≤ X ≤ 1000000
TR
DO

Sample Input (standard input)


5
64
9
IS

8
2
21
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
Sample Output (standard output)

NO
BU
Case #1 : square cubic
Case #2 : square
Case #3 : cubic
Case #4 : prime
Case #5 : none

R I
O
T
D
S
DI

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.

You might also like