2777 - 2023GEC1506 - 0417 - EXAM 1 Scoreboard

Time

2023/04/17 12:30:00 2023/04/17 15:10:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

12770 - GEC1506 - Basic - Factorials   

Description

We have introduced the loop and condition concept in our course, you can use these concepts to finish the following task.

Calculate N! = 1×2×...×(N-1)×N

Note that

  1. You DO NOT need to consider the number exceed the range of integer or long long data type. 
  2. 0! = 1

 

Input

A line of text with a number.

Output

A line with the factorial result with the string "is the answer".

Sample Input  Download

Sample Output  Download

Tags




Discuss




12835 - GEC1506 - Advanced -TW ID number Decoding   

Description

We have introduced the encoding and decoding.

In this problem, you need to process the numerical format of the TW ID number and return the register location of the person.

 

Assuming that there is an ID number as M140051653, the alphabet in the ID number is the registered city/county and the rest numbers are used to verify the ID number.

To make sure the ID number is a verified ID, we need to follow the rules:

  1. Convert the alphabet M to numerical form as 21. (We will provide the mapping table below)
  2. Present all the digits of the ID number (M140051653) as a numerical form (21140051653).
  3. For each digit, we multiply with a given number as:
    n_{1}\times 1+n_{2}\times 9+n_{3}\times 8+n_{4}\times 7+n_{5}\times 6+n_{6}\times 5+n_{7}\times 4+n_{8}\times 3+n_{9}\times 2+n_{{10}}\times 1+n_{{11}}\times 1
  4. Sum all the multiplied result.
  5. As a qualified ID number, the remainder of the sum result divided by 10 should be 0.
  6.  Hint: You can use isdigit() to verify if the input character is digit or not 

Input

The first several lines are the required mapping table for the alphabet and its number, such as:

K,19,MiaoliCountry
M,21,NantouCounty
N,22,ChanghuaCounty
O,35,HsinchuCity

The last line is the ID number that is missing the alphabet which is shown as:

140051653

 

Note that the candidate will not be the same for different test cases.

Output

You need to provide the possible registering city/county for the id number.

 

To find the possible registering city/county, you need to go over all the possible candidates to verify them.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13176 - GEC1506 - medium - eliminate unwanted elements   

Description

Given a set of elements and another set of unwanted elements, remove the unwanted elements.

Input

There are two lines for the input, which are

  1. The set of elements
  2. The set of unwanted elements

e1 e2 e3 ... en                <--- elements 1~n

u1 u2 ... um                   <---- unwanted elements 1~m

Note that

  1. Each element is separated by a SPACE token.
  2. You need to remove the elements e which also exist in u. (Case sensitive)

Hint: You can use an index to find an element in a list

elements = [1, 2, 3]

print(elements[1]) # 2

Output

Print out a line of elements with unwanted elements removed, where each element are connected by a SPACE token (" ").

Note that there will be a new line default by python's print() function. If you are using python's print(), just ignore this line.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss




13880 - GEC1506 - Advanced - Decoding the Secret Message   

Description

 

Jerry has a secret girlfriend, and they have to communicate with each other using secret messages. Jerry needs your help to decode the messages that his girlfriend sends to him.

The message is encoded using a code provided to Jerry. The code is a list of numbers that indicates which characters to select from the secret message

The characters are selected in the order specified by the code(You need to sort the code, and take the character from the smallest position to the biggest position one by one). If a character in the secret message is "*", it indicates a whitespace.

Once all the specified characters have been selected from the secret message, they are concatenated and converted to uppercase to form the final message.

Hint. You could use sort() function to sort the list.

Input

 

One line of code, following a line of secret message.


The format of each line is given as: 


Code
Secret Message

 

Examples are shown below. 


5 4 3 11 10 13 9 8 7 2

YI*loJVe*yoJUXJ
 

Output

 

The output will be 


I LOVE YOU

Take the 2nd, 3rd, 4th... 13th character from the secret message (from the smallest
character position to the biggest one). Replace "*" with whitespace and convert the resulting string to uppercase. Then you would get the final output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13881 - Sales Forecast   

Description

 

Ben is planning to open a pizza store. He wants to predict the sales volume of pizza for a week in order to prepare the ingredients accordingly.

The formula for calculating the sales volume for each day of the week is as follows:
(Note that f1, f2, f3 are factors that could affect the pizza sales. They are all integers)

Monday's predicted volume = 2 * f1 + 3 * f3
Tuesday's predicted volume = 0.2 * f1 + 5 * f3 + 20
Wednesday's predicted volume = 0.5 * f1 + 4 * f3 + 10
Thursday's predicted volume = 0.35 * f1 + 7 * f3 + 20
Friday's predicted volume = 0.2 * f1 + 5 * f2 + 100
Sunday's predicted volume = 0.8 * f1 + 15 * f2 + 105

Ben wants to have a day off on Saturday, so he doesn't need to predict the volume for Saturday.
Additionally, since it's not possible to sell half a pizza, you must round the calculated volume to the nearest whole number.

Note: Use the round() function to round to the nearest whole number.

Input

 

Six lines of factors

The format of each line is given as:


f1 f2 f3 for Monday
f1 f2 f3 for Tuesday
f1 f2 f3 for Wednesday
f1 f2 f3 for Thursday
f1 f2 f3 for Friday
f1 f2 f3 for Sunday

 

Examples are shown below. 


1 2 3
2 4 5
5 6 7
8 10 2
4 5 10
7 4 5

 

Output

 

The output will be:


Monday:11
Tuesday:45
Wednesday:40
Thursday:37
Friday:126
Sunday:171


Example: Monday's sales volume = (2 * 1) + (3 * 3) = 11

Sample Input  Download

Sample Output  Download

Tags




Discuss