3061 - I2P(I)2024_Yang_hw2 Scoreboard

Time

2024/09/10 19:00:00 2024/09/24 18:30:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
11112 Big Number
12134 The Big Hammer Rise
13552 Easy math problems
13601 Ultimate caesar salad
14413 Temmie's college life

11112 - Big Number   

Description

Replace the ??? in the following code so that the program can correctly compute
the square of the number entered by the user.
Assume that the input number is always an 8-digit positive integer.
* Note that the output format is always 16-digit wide with space prepended if needed.

For example, 
(11111111)^2 = _123456787654321
_ is a space character.


#include <stdio.h>
/* 2016/09/22 */
int first4(int x){
   return x/10000;
}
int last4(int x){
   /* The operator % in C computes the remainder after division.
      For example, the answer of 23%7 will be 2.*/
   return x%10000;
}
int first8(int x){
   return x/100000000;
}
int last8(int x){
   return x%100000000;
}
int shift4(int x){
   return x*10000;
}
int main(void){
   int x;
  int a, b;
  int c1, c2, c3;
  /* Assume that the input is always an 8-digit positive integer. */
  scanf("%d", ???); 
  a = first4(x);
  b = last4(x)
  c3 = ???;
  c2 = ???;
  c1 = ???;
  printf("%4d%08d%04d", ???, ???, ???);  
  /* %04d will display a 4-digit number and add 0 as padding before the number if necessary */
  return 0;
}

[Hint]
Assume that the input 8-digit integer x can be expressed by a*10000 + b .
The square of x can be expressed as a*a*100000000 + 2*a*b*10000 + b*b .
We may partition the computation into three parts.
An illustration of the idea is as follows:
 
| 4 digits | 4 digits | 4 digits | 4 digits |
                             |        b * b            |
              |      2 * a * b         |
|        a * a            |
|    c1      |          c2              |    c3     |
 
※要注意進位的情形!!

Input

The input is always an 8-digit positive integer

Output

the square of input .

Note that you do not need to print ‘\n’ at the end of the output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12134 - The Big Hammer Rise   

Description

A famous streamer once said: " Abortion Uncle!! Begin abort!!! " The Abortion Uncle is also known as "The Big Hammer Rise". The famous streamer wants to know the exactly time "Big Hammer Rise" kill an enemy. Because he got a double kill, he know exacly two time which denote as a, b.


The famous streamer will give you two number a,b which are represented as float numbers and have two digit after the decimal point.

 

For example:

If a,b are ranged from 1~99, 1<= a , b < 100;

a,b will be like these forms: 18.00,  99.30,  71.22

 

You need to calculate ans = a*b, and ans should follow the rule:

if the number of digits after decimal point is less then four digits, then you need to print 0 to make it four digits.

For example: 18.56 -> 18.5600, 18 -> 18.0000, 18.9 -> 18.9000

 

If you tell him the right answer he will help you kill the ice bird.

 

 

( Note: you can use scanf("%d.%d %d.%d", &int, &int, &int, &int). Use %f may cause trouble because the precision of float type. )

( Note: you can use  printf("%d.%04d\n", int/10000, int%10000); )

Input

input only contains two float number a,b1<= a , b < 100 ) the two number are seperated by a blank.

 

Output

output contains only a float number which have four digit after the decimal point.

remember to print \n at the end of output.

Sample Input  Download

Sample Output  Download

Tags




Discuss




13552 - Easy math problems   

Description

Patrick is going to hand in his math homework tomorrow. He left his homework undone and played outside all day with Squidward. It’s now 3 am and Patrick doesn’t know how to finish these problems at all since he never studies. Therefore, he comes to you, the smartest person he knows, and hopes you can solve all of the problems in his homework book.

 

 

 

The problems are easy: given a math expression containing two numbers and an operator. Calculate the result rounded to 3rd decimal places.

For example, the answer of 12.1 + 7 is 19.100, and the answer of 7 / 3 is 2.333.

Patrick will bring you a Krabby Patty if you successfully answer all questions.

Input

Given a math expression containing two numbers xy and a char c (‘+’, ‘-’, ‘*’ or ‘/’) seperating the numbers.
(-1000 x, y 1000)

Output

Output the answer, which is a floating point rounded to 3rd decimal places.

Please print '\n' at the end of the line.

Sample Input  Download

Sample Output  Download

Tags

FlyHighHigh



Discuss




13601 - Ultimate caesar salad   

Description

Sometimes, the hackers would intercept the messages sent by Caesar. Since privacy is quite valued by Caesar, he discovers a new way of encryption.

The encryption process includes two steps:

  • First, we would apply a specific number of right shifts (within [0, 25]) for each letter in the string. For instance, if we have a message "AAAAA", and we want to apply {1, 2, 3, 4, 5} of right shifts for each letter, then the encrypted message would be "BCDEF". We can regard the letter following Z as A again. For example, if we apply 3 right shifts on Y, it would be B.
  • Second, we change every letter from uppercase to lowercase and lowercase to uppercase. For instance, if we have a shifted message "aBcDe", the final encrypted message would be "AbCdE". (It does not help for the encryption. Caesar does it for fun.)

Given a pair of plaintext and encrypted message, we can derive the encryption scheme, that is, how many right shifts are applied to each letter of the string. Caesar can't wait to have more salads! To order more salads, please help him to encrypt another given message by applying the encryption scheme. 

Sample I/O's number of shifts: {1, 24, 5, 3, 21}.

Input

The input has three lines: Plaintext A, encrypted message A' of A, and another plaintext B to be encrypted. These strings contain only uppercase and lowercase letters (A-Z, a-z), and their length is all exactly 5.

Output

Print one line, the encrypted message B' of B.

Please remember to print '\n' at the end.

Sample Input  Download

Sample Output  Download

Tags




Discuss




14413 - Temmie's college life   

Description

Temmie is a freshman at Tsinghua University. Upon enrollment, he learned about his student ID, which consists of a college code C and a string of numbers ID.


He is curious about what other people's student IDs represent, so based on the given college code and student ID, please calculate the following information according to the rules:

  1. Degree: If the alphabetical order of the college letter C is <= 'L', then the student is a "Bachelor", otherwise a "Master" (without quotation marks)
  2. Class: The third digit from the end of the student ID, where 1 represents 'A', 2 represents 'B', and so on (without quotation marks)
  3. Enrollment year: The number formed by the first three digits of the student ID
  4. Seat number: The number formed by the last two digits of the student ID

Hint: Please use strings in C to solve this problem.

 

 

Input

The input consists of only one line, containing a letter C and a string ID of length 10 composed of digits 0-9 (may have leading zeros), separated by a space.

 

Constraints

  • C is an uppercase letter.
  • The length of ID is 10. (May include leading zeros)
  • for all i in [1,10], 0 ≤ id≤ 9
  • id8 ≠ 0

Output

The output consists of four lines, each containing a string or an integer, representing the degree (string), class (string), enrollment year (integer), and seat number (integer).

"integer" means it doesn't include any unnecessary leading zeros.

 

Please remember to print "\n" at the end

 

Sample Input  Download

Sample Output  Download

Tags




Discuss