Number Conversion Number conversion is a method that is often used in world of computing. This method aim to simplify the analysis and calculation process. Bibi, a novice data scientist, is looking at...

Number Conversion Number conversion is a method that is often used in world of computing. This method aim to simplify the analysis and calculation process. Bibi, a novice data scientist, is looking at the series of data with irregular values. Each Ai value that Bibi sees can be anywhere from -1018 to 1018. Seeing such a large range of numeric values, Bibi asks you to do conversion on each value in the series so every new values is as minimum as possible while still maintaining larger, smaller and equal property with every other values in the initial series. The smallest number Bibi allow is 1. Help Bibi convert the number according to the criteria above. For example, there is a series with the values 99, -30, 0, 20, 1, 20. • the lowest value -30 is converted to 1. • second lowest value 0 is converted to 2. • third lowest value 1 is converted to 3. • lowest fourth value 20 is converted to 4. • the highest value 99 is converted to 5.


COMP6047 – Algorithm and Programming Number Conversion Number conversion is a method that is often used in world of computing. This method aim to simplify the analysis and calculation process. Bibi, a novice data scientist, is looking at the series of data with irregular values. Each Ai value that Bibi sees can be anywhere from −1018 to 1018. Seeing such a large range of numeric values, Bibi asks you to do conversion on each value in the series so every new values is as minimum as possible while still maintaining larger, smaller and equal property with every other values in the initial series. The smallest number Bibi allow is 1. Help Bibi convert the number according to the criteria above. For example, there is a series with the values 99, -30, 0, 20, 1, 20. • the lowest value -30 is converted to 1. • second lowest value 0 is converted to 2. • third lowest value 1 is converted to 3. • lowest fourth value 20 is converted to 4. • the highest value 99 is converted to 5. Therefore, you get the new sequence 5, 1, 2, 4, 3, 4. Format Input There are T test cases. Each testcase contains the integer N ,which represents the amount of data in the series. On the next line there are N numbers which represents the value of each number in the series. Format Output Output T line with format “Case #X:”, where X represents the testcase number, then followed by N converted numbers. Constraints • 1 ≤ T ≤ 20 • 1 ≤ N ≤ 1000 • −1018 ≤ Ai ≤ 1018 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 Sample Input (standard input) 3 5 1 999 888 100 400 8 5 5 1 6 1 6 1 1 5 -30 -30 30 0 -10000 Sample Output (standard output) Case #1: 1 5 4 2 3 Case #2: 2 2 1 3 1 3 1 1 Case #3: 2 2 4 3 1 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 Number Conversion Konversi angka merupakan suatu metode yang sering digunakan dalam dunia komputasi. Tujuannya adalah untuk mempermudah proses analisa dan perhitungan. Bibi, seorang ilmuwan data pemula, sedang melihat sebuah deretan data yang nilainya tidak beraturan. Setiap nilai Ai yang dilihat oleh Bibi dapat berkisar antara −1018 hingga 1018. Melihat jangkauan nilai angka yang begitu besar, Bibi meminta tolong anda untuk melakukan konversi terhadap setiap nilai dalam deretan tersebut menjadi angka seminimal mungkin namun tetap menjaga sifat lebih besar, lebih kecil dan sama dengan terhadap setiap nilai lain pada deretan awal. Angka terkecil yang diperbolehkan Bibi adalah 1. Bantulah Bibi mengkonversi angka tersebut sesuai kriteria di atas. Contoh, terdapat deretan dengan nilai 99, -30, 0, 20, 1, 20. • Nilai terendah -30 dikonversi menjadi 1. • Nilai kedua terendah 0 dikonversi menjadi 2. • Nilai ketiga terendah 1 dikonversi menjadi 3. • Nilai keempat terendah 20 dikonversi menjadi 4. • Nilai tertinggi 99 dikonversi menjadi 5. Oleh karena itu, deretan baru yang didapatkan adalah 5, 1, 2, 4, 3, 4. Format Input Terdapat T buah testcase. Setiap testcase berisi bilangan bulat N , yang merepresen- tasikan jumlah data dalam deretan tersebut. Pada baris selanjutnya terdapat N angka yang merepresentasikan nilai dari setiap angka pada deretan tersebut. Format Output Keluarkan T baris dengan format “Case #X:”, dimana X merepresentasikan nomor testcase, kemudian diikuti dengan N angka yang telah dikonversi tersebut. Constraints • 1 ≤ T ≤ 20 • 1 ≤ N ≤ 1000 • −1018 ≤ Ai ≤ 1018 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 Sample Input (standard input) 3 5 1 999 888 100 400 8 5 5 1 6 1 6 1 1 5 -30 -30 30 0 -10000 Sample Output (standard output) Case #1: 1 5 4 2 3 Case #2: 2 2 1 3 1 3 1 1 Case #3: 2 2 4 3 1 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.
May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here