Introduction training

Box Introduction

Because I saw a lot of people face many difficulties when they brushed OJ, for example, they could n’t think of what knowledge points should be used to do this question, and sometimes I saw the answer to a question, because the lack of knowledge points is also difficult to understand the cause and effect of the problem, the principle of implementation, Although I can solve algorithm problems, I do n’t know which solution is the best in many types of solutions, or I can’t quickly come up with the best solution, so I set up this column as a daily problem for everyone to learn With discussions, the topics come from leetcode and Niu Ke, and the questions of the next article will be left at the end of each article.

Seeing a lot of people, when faced with many painted OJ distress, for example, think of what knowledge should be used to do this topic, see the answer to a question sometimes, because of the lack of knowledge is difficult to understand its causes and consequences, realization of the principle, Although the algorithm can solve the problem, but the solution does not know which of the many kinds of best solution, also, or can not quickly come up with the best solution, so I set up this column, in the form of a question a day for everyone to learn and discussion topics are derived from cattle leetcode and customer network, at the end of each article will leave the question in the next article.

Problem Description (title presentation)

Practice makes perfect

The teacher often tells us, "is the best way to learn programming Shangjishijian, because you want on the computer under the instructions you want the computer to help work, and much more computer 'exchange', the practice of real knowledge.

Input Description:
None

Output Description:
Practice Makes Perfect!

I am a big V

Everyone wants to be big V (VIP: Very Important Person), but little by little job, start small v start. Required output lowercase letters consisting of V-v

Input Description:
None

Output Description:
VV
VV
V

Tolerance is a virtue

Determining how much of the different types of integer data (bytes) in the memory, to output different data types occupy much integer (bytes) in the memory.

Input Description:
None

Output Description:
Different how much of integer data type (bytes) in the memory, the number of bytes representing different integer data type in memory See sample output, the sample output format specific?. Sample output follows:
? Short of IS at The size bytes.
At The size of int bytes IS?.
At The size of Long IS bytes?.
At The size of Long Long IS bytes?.

Hello world displayed code

BoBo teach kiki learn C programming language, starting with the classic "screen displays Hello, world!" Begin, the output corresponding to the function code.

Input Description:
None

Output Description:
printf ( "the Hello, world \ the n-!");

Divide and rule

There is an important programming idea is to divide and conquer (Divide and conquer). The so-called "divide and rule" is to a complex problem in a certain way into solving several parts in the same manner but smaller, and then one by one to solve, respectively find a solution to the various parts of the solution of the various parts of the composition of the solution of the whole problem. C language source code typically includes a plurality of functions, each corresponding to a sub-function after large tasks, wherein the inlet is a main function of the program begins execution. The main function generally includes logic functions of four parts: the definition of data, input data, processing data, output data.

Input Description:
None

Output Description:

  1. Define data;
  2. Input data;
  3. Process data;
  4. Output data.

small plane

KiKi learned printf output information on the screen, he wanted to output a small plane. Please help him write a program output this small planes.

Input Description:
None

Output Description:
**
**



      *              *
      *              * 

Shorten the binary

Our treatment is usually an integer expressed in decimal, binary complement code is stored in computer memory, the binary representation of the integer typically longer, in order to facilitate understanding in the programming and data processing process, usually octal and hexadecimal shorten the two's complement representation of integers, but maintained the expression characteristics of a binary number. Please output the corresponding decimal integer 1234 octal and hexadecimal.

Input Description:
None

Output Description:
decimal integer corresponding to 1234 octal and hexadecimal (capital letters), separated by a space, and requires, the leading zero before the octal, hexadecimal number is displayed before the leading 0X.

Hex decimal turn

BoBo wrote a hexadecimal integer ABCDEF, he asked KiKi corresponding decimal integer is.

Input Description:
None

Output Description:
hexadecimal integer corresponding to the decimal integer ABCDEF, width 15 occupied domain.

The return value of printf

KiKi write an output "Hello world!" Program, BoBo teacher told him printf function returns a value, you can help him write a program output printf ( "Hello world!") Return value it?

Input Description:
None

Output Description:
consists of two lines:
The first line "! The Hello world"
( "! The Hello world") returns the value of the second printf behavior after the call.

Input and output results

Enter the score 3 families, then the three subjects output, performance is an integer form.

Input Description:
row 3 subjects results, separated by spaces, the range (0 to 100).

Output Description:
line, the results show up to 3 families, output format, see sample output.

Students basic information input and output

In order to enter a student's school, as well as Section 3 (C language, mathematics, English) scores, the output of the student's school number on the screen, Section 3 scores.

Enter a description:
between the school and the No. 3 Division achievement, student number and scores separated by semicolons, separated by commas between the results.

Output Description:
school, grades 3 families, output format, see sample output.

Pyramid character

A character input, is used to construct a triangular pyramid.

Input Description:
Enter the single line one character.

Output Description:
triangular pyramid configuration of the character.

ASCII code

BoBo teach KiKi character character constant or variable character represented in memory is stored in ASCII format. BoBo out of the question to KiKi, convert the ASCII code corresponding to the character and outputs them.
73, 32, 99, 97, 110, 32, 100, 111, 32, 105, 116, 33

Input Description:
None

Output Description:
All subject ASCII conversion output corresponding to a given character.

Date of Birth input and output

Enter a person's date of birth (including the date), the birthday of the year, month, day respectively output.

Input Description:
Enter the single line, date of birth, including the date, number between date no delimiter.

Output Description:
three lines, the first year of birth behavior, the behavior of the second month of birth, date of birth third acts. If the month or the output of a median number of days, the number of bits required in front of the 1 0s.

According to the format input and output switching

Input two integers, the range of -2 31 to 2 31 - 1 and the number of switching two outputs.

Description Input:
Input single line, in accordance with the format of the input two integers, a range, in the middle "," separated.

Output Description:
The format of the output by two integers, with the middle "," separated.

Character to ASCII

BoBo teach KiKi character character constant or variable character represented in memory is stored in ASCII format. BoBo KiKi to a question, a character input, the output of the character corresponding to the ASCII code.

Enter a description:
a row, a character.

Output Description:
the ASCII code line, the output corresponding to the input character.

Value calculation expression

Calculate the expression "(-8 + 22) × a-10 + c ÷ 2", where, a = 40, c = 212.

Input Description:
None

Output Description:
(-8 + 22) after the result of calculation × a-10 + c ÷ 2 , is an integer.

Computing division with remainder

Given two integers a and b (-10,000 a, b <10,000 <), b is calculated by dividing a number of the integer quotient and a remainder.

Input Description:
one line, comprising two integers a and B, were dividend and divisor (not zero), separated by a space.

Output Description:
a line, comprising two integers, followed by an integer quotient and a remainder, separated by a space.

A four-digit counter output

A four-digit, inverting output.

Input Description:
line, enter an integer n (1000 <= n <= 9999).

Output Description:
corresponding to four digits for the input, the inverted output of each group.

kiki math

Question: KiKi 5 years old this year, has been able to recognize non-negative integer less than 100, and the addition calculation and can be non-negative integers less than 100. When, however, computing BoBo teacher found positive integer greater than or equal to 100 is performed KiKi following rules:

  1. Retaining only the last two numbers, for example: for KiKi 1234 is equivalent to 34;
  2. If the calculation result is greater than or equal to 100, it is only retained KIKI last two calculated results, if the two bits is 0 ten, leaving only bits.

For example: 45 + 80 = 25
requirements of a given non-negative integers a and b, the analog arithmetic rule KiKi calculate a value of + b.

Input Description:
one line, two input and a non-negative integer B, separated by a space. (0 <= a, b < = 2 ** 31-1).

Output Description:
for each set of input and output values of a + b is calculated according to the rules of operation KiKi.

Released five original articles · won praise 0 · Views 71

Guess you like

Origin blog.csdn.net/weixin_45577658/article/details/105144264