- 2021-11-28 22:15
*views 1*- development language
- C language
- back-end

The answer will be updated in a few days .

1.

Little blue IP Address is 192.168.*.21, among * It's a number , What is the maximum possible number ?

2.

If an integer g Can divide integers at the same time A and B, Then called g yes A and B Common divisor of . for example ：43 yes 86 and 2021 Common divisor of .

Excuse me 1（ contain ） reach 2021（ contain ） in , How many numbers and 2021 Presence greater than 1 Common divisor of . Please note that 2021 and 2021 Have greater than 1

Common divisor of , So when calculating, you have to calculate one .

3.

2021 Is a very special number , It can be expressed as the square difference between two nonnegative integers ,2021 = 45 * 45 - 2 * 2.

2025 It is also a special number , It can be expressed as 2025 = 45 * 45 - 0 * 0.

Excuse me? , stay 1 reach 2021 How many of these numbers are there ?

Please note that , Some numbers can be expressed in many ways , for example 9 = 3 * 3 - 0 * 0 = 5 * 5 - 4 * 4, Only count once when calculating the answer .

4. Xiaolan wants to use it 01 String to express a paragraph of text , This text contains a, b, c, d, e, f common 6 Letters , The number of occurrences of each letter is ：a appear 10 second ,b appear

20 second ,c appear 3 second ,d appear 4 second ,e appear 18 second ,f appear 50 second .

Xiaolan is going to use the determined for each letter separately 01 String to represent , Different alphabetic 01 The string length can be different .

When representing text , Put the corresponding of each letter 01 The strings are directly connected to form the final 01 strand . In order to restore the text normally , The code of Xiaolan must be a prefix code , That is, the corresponding character of any character 01 No string can correspond to another character 01 Prefix of string .

for example , The following is a valid code ：

a: 000

b: 111

c: 01

d: 001

e: 110

f: 100

among c The length of the is 2, The coding length of other letters is 3, This means that the total length of this text is ：103+203+32+43+183+503=312.

The above coding is obviously not optimal , Put the above f The code of is changed to 10, Still meet the conditions , But the total length is 262, Be short 50.

The total length after coding should be as small as possible , The encoding corresponding to characters that appear more often should be shorter , The encoding length corresponding to characters with fewer occurrences .

Excuse me? , In the best case , What is the minimum total length after encoding ?

5. The matrix below contains ABCDEF Six characters , How many times did the most characters appear ?

FFEEFEAAECFFBDBFBCDA

DACDEEDCCFFAFADEFBBA

FDCDDCDBFEFCEDDBFDBE

EFCAAEECEECDCDECADDC

DFAEACECFEADCBFECADF

DFBAAADCFAFFCEADFDDA

EAFAFFDEFECEDEEEDFBD

BFDDFFBCFACECEDCAFAF

EFAFCDBDCCBCCEADADAE

BAFBACACBFCBABFDAFBE

FCFDCFBCEDCEAFBCDBDD

BDEFCAAAACCFFCBBAAEE

CFEFCFDEEDCACDACECFF

BAAAFACDBFFAEFFCCCDB

FADDDBEBCBEEDDECFAFF

CDEAFBCBBCBAEDFDBEBB

BBABBFDECBCEFAABCBCF

FBDBACCFFABEAEBEACBB

DCBCCFADDCACFDEDECCC

BFAFCBFECAACAFBCFBAF

6.

Problem description

Xiaolan is going to the store to buy a pencil .

Pencils must be bought in whole boxes , A whole box 12 branch , Price p element .

Xiaolan should at least buy it t A pencil , How much does he spend at least ?

Input format

The input line contains two integers p,t, Separated by a space .

Output format

The output line contains an integer , Indicates the answer .

sample input

5 30

sample output

15

Example description

Xiaolan should at least buy it 3 Box can guarantee to buy 30 A pencil , Total cost 15 element .

Scale and agreement of evaluation cases

For all profiling cases ,1 <= p <= 100,1 <= t <= 10000.

7. Problem description

Given the length of three sides of a triangle a, b, c, Is this triangle a right triangle .

Input format

The input line contains three integers a, b, c, Represents the length of three sides of a triangle , Adjacent integers are separated by a space .

Output format

If it's a right triangle , output “YES”（ uppercase ）, Otherwise output “NO”（ uppercase ）.

sample input

3 4 5

sample output

YES

sample input

4 5 4

sample output

NO

Scale and agreement of evaluation cases

For all profiling cases ,1 <= a, b, c <= 1000.

8. Problem description

n A child is playing a game , Everyone should share a little secret .

Every child has one 1 reach n Number of , No duplicate number .

To make the game more interesting , The teacher gave each child a card , There's one on it 1 reach n Number of , Each number appears exactly once .

Each child writes his secret on paper , Then pass the secret to the children with the corresponding number according to the number on the card sent by the teacher . If the number given by the teacher is exactly his own number , The secret is in your own hands .

The children will write down the secret when they get the secret of others , The teacher will instruct all the children to pass on the secrets in their hands , Still pass the secret to the children with the corresponding number according to the number on the card sent by the teacher .

This is repeated n second .

Now? , Each child wrote down many secrets .

The teacher is looking for some children now , Can tell all the secrets , How many children should the teacher find at least ?

Input format

The first line of input contains an integer n.

The second line contains n Integer a[1], a[2], …, a[n], Adjacent integers are separated by spaces , Each represents the number 1 reach n The number of children received .

Output format

The output line contains an integer , Indicates the answer .

sample input

6

2 1 3 5 6 4

sample output

3

Example description

Final child 1, 2 They know each other's secrets , children 3 Only know your own secrets , children 4, 5, 6 They know each other's secrets .

At least find 3 Only a child can tell all the secrets .

Scale and agreement of evaluation cases

about 30% Evaluation use cases for ,2 <= n <= 30.

about 60% Evaluation use cases for ,2 <= n <= 1000.

For all profiling cases ,2 <= n <= 100000.

9. Problem description

One 1 reach n The permutation of is called a semi increasing sequence , It refers to the monotonic increase of the value at the odd position in the arrangement , The value at the even position also increases monotonically .

for example ：(1, 2, 4, 3, 5, 7, 6, 8, 9) Is a semi increasing sequence , Because the value at its odd position is 1, 4, 5, 6,

9, Monotonic increasing , The value at the even position is 2, 3, 7, 8, Also monotonically increasing .

Excuse me? ,1 reach n How many semi increasing sequences are there in the permutation of ?

Input format

The input line contains a positive integer n.

Output format

The output line contains an integer , Indicates the answer , The answer may be big , Please output the answer divided by 1000000007 Remainder of .

sample input

5

sample output

10

Example description

There are the following semi incremental sequences ：

(1, 2, 3, 4, 5)

(1, 2, 3, 5, 4)

(1, 2, 4, 3, 5)

(1, 3, 2, 4, 5)

(1, 3, 2, 5, 4)

(1, 4, 2, 5, 3)

(2, 1, 3, 4, 5)

(2, 1, 3, 5, 4)

(2, 1, 4, 3, 5)

(3, 1, 4, 2, 5)

Scale and agreement of evaluation cases

about 50% Evaluation use cases for ,2 <= n <= 20.

For all profiling cases ,2 <= n <= 1000.

10. Problem description

Xiao Lan lives in LQ city , He's going to Xiao Qiao's house today .

LQ The city can be regarded as a n that 's ok m A grid of columns .

Xiaolan's family lives in No 1 Line number 1 column , Little Qiao lives in No n Line number m column .

Xiaolan can walk in the grid , He didn't want to go outside the grid .

Some places in the city are scenic parks , Some places are bustling streets . Xiao Lan likes the park very much , I don't like the street . He marked each grid in the grid with an attribute , Or a favorite park , Marked as 1, Or the streets you don't like are marked 2. The places where Xiao Lan and Xiao Qiao live are marked with 1.

Xiaolan can only go from one square to the adjacent squares in the same row or column at a time . He wants to find a way , Make the discontinuous walk twice marked as 2 Streets of , How many times does he have to go through the street under this premise ?

Input format

The first line of input contains two integers n, m, Separated by a space .

next n that 's ok , Each line has a length of m Second digit string , A label that represents a city .

Output format

The output line contains an integer , Indicates the answer . If there is no scheme that meets the conditions , output -1.

sample input

3 4

1121

1211

2211

sample output

2

sample input

3 4

1122

1221

2211

sample output

-1

sample input

5 6

112121

122221

221212

211122

111121

sample output

5

Scale and agreement of evaluation cases

about 50% Evaluation use cases for ,2 <= n, m <= 20.

For all profiling cases ,2 <= n, m <= 300.

Technology

Daily Recommendation

views 2

views 2

views 2

©2019-2020 Toolsou All rights reserved,

Redis Underlying data structure A person who dissuades others from learning computer , Are not good people win10 System computer C Where's the disc ,c disc users where? (win10c Disk not found users) Freshman c Language student management system （ lower ） hospital WIFI Which family is strong ? utilize Python Script unlimited spoof girlfriend computer C language program design —— Student management system Byte runout - Test development practice - One side cool meridian python Run code at specified time 5 Best style Linux Server system recommendation Anti anxiety life after naked resignation , I believe everything will have the best arrangement