2228 - I2P(I)2020_Huang_lab13 Scoreboard

Time

2020/12/24 08:00:00 2020/12/24 12:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
13079 Decimal to Binary Converter Using Recursion
13080 Binary Search

13079 - Decimal to Binary Converter Using Recursion   

Description

Convert the given decimal number (>0) to binary using recursion.

 

For example,

if we give you a decimal number 8, you have to print the corresponding binary number 1000.

 

We have provided the partial judge code (13079.c) below for you. All you need to do is complete the void dec2bin(int num) function and submit it to NTHU Online Judge System.

void dec2bin(int num){

             ...

             ...

}

 

Attention: Using recursion to solve this problem.

 

Input

Given a decimal number n, where n > 0

 

Output

Print the corresponding binary number

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

13079.c

Partial Judge Header

13079.h

Tags




Discuss




13080 - Binary Search   

Description

 

Given a sorted array and a key. Find whether or not the key is in the array. If yes, output its location. If not, print "Not found". Input format is as follows:

 

Input Case:

7

1 3 5 7 8 10 11

5

 

Explanation:

In which, 7 stands for the length of the array and 5 stands for the key. You are to determine whether the key appears in the array or not. An example shows the concept of Binary Search as below:

Binary Search Algorithm - Java Program Of Binary Search Algorithm

Also, we have provided the partial judge code (13080.c) below for you. All you need to do is complete the int binarySearch(int *sortedarr, int start, int end, int key) function and submit it to NTHU Online Judge System.

int binarySearch(int *sortedarr, int start, int end, int key){

             ...

             ...

}

 

(Figure Reference Link: https://codenuclear.com/binary-search-algorithm/)

Input

Given the length of the sorted array.

Then followed by the elements of the sorted array.

Finally, given the key that you wanna find its location.

 

Output

Print the location of the key.

 

Sample Input  Download

Sample Output  Download

Partial Judge Code

13080.c

Partial Judge Header

13080.h

Tags




Discuss