Noip Preliminary Finishing

Source: Internet
Author: User
Tags binary to decimal

A 1600x900, 16-bit color bitmap, which is the space required to store image information?
A. 2812.5KB B. 4218.75KB C. 4320KB D. 2880KB
A
1 KB = 1024x768 byte
16/2 = 8 byte
The inverse of a positive number is its own
Negative numbers are reversed in addition to the sign bit
The complement of a positive number is itself
The complement of negative number is anti-code plus 1
As long as the test is generally negative, because the positive number is a binary conversion is not a good test ...

Memory, operator, controller, input

The host is composed of CPU and memory ram
ROM read-only non-writable, seems to have some underlying operations
Peripheral consists of external memory (hard disk), input
The above constitutes the hardware system

Bus structure DB AB CB data address Control Bus
Address unidirectional, Width determines memory capacity size data bidirectional
32bit address bus can use 2^32 byte, i.e. 4 * 2 ^ = 4GB

a tree full of two forks if there is a K layer, then there are 2 ^ k-1 nodes, and its K-level node number is 2 ^ (k-1)

Binary and 16 binary interoperability:
0101 1101 1111.1001
5 D F. 9

Touch screen input are ...

What is not a hardware component of a PC? Virtual memory (does not count as hardware
Wrong row formula
\[d_n=n! \sum_{i=0}^n ( -1) ^i \frac{1}{i!} \]
Two-term theorem:

\[(a+b) ^n= \sum_{k=0}^nc_n^ka^{n-k}b^k\]

Common e-mail protocols are SMTP, POP3, IMAP4, which are all part of the TCP/IP protocol cluster
Www

Select question: The following correct program section is? Note that the meaning of "=" is assigned, because it says the program segment

The code in the preliminary round may be a bit of water, but the choice and problem solving is not water, it really may need to use a complex method (such as DP ... )

Note Reverse Storage
Addition
Rokua P1601
Two ways of writing, I'm more inclined to the add function in the wording

#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include < queue>using namespace std; #define DEBUG (x) cerr << #x << "=" << x << endl;const int MAXN = 1000 0 + 10;string A1,b1;int A[MAXN], B[MAXN], c[maxn];void Add (int a[], int b[], int c[], int la, int lb) {int len = max (l    A, lb), x = 0;        for (int i=1; i<=len; i++) {c[i] = A[i] + b[i] + x;        x = c[i]/10;    C[i]%= 10;    } if (x! = 0) C[++len] = x;    for (int i=len; i; i--) {cout << c[i];    }}int Main () {cin >> A1 >> B1;        if (a1[0] = = ' 0 ' && b1[0] = = ' 0 ') {//This notation first 0, and note that the character 0 is not an integer 0, can not be used!        cout << "0";    return 0;    } int la = A1.length (), lb= b1.length ();    /* for (int i=0; i<la; i++) {a[la-i] = a1[i]-' 0 ';    } for (int i=0; i<lb; i++) {b[lb-i] = b1[i]-' 0 '; } Add (A, B, C, LA, LB) */for (int i=0; i<la; i++) {a[la-i-1] = a1[i]-' 0 ';    } for (int i=0; i<lb; i++) {b[lb-i-1] = b1[i]-' 0 ';    } int tot = MAX (LA, lb), x = 0;            for (int i=0; i<tot; i++) {C[i] + = A[i] + b[i];//here is + =, carry is OK if (C[i] >=) {c[i+1]++;        C[i]-= 10;    }} tot++;    while (!c[tot]) tot--;    for (int i=tot; i>=0; i--) {//Here is the beginning of tot since the 0-bit has been deleted cout << c[i];  } return 0;}

Subtraction
Rokua P2142
Multiplication
Rokua P1303
High-precision except low-precision
Rokua P1480

#include <algorithm> #include <iostream> #include <cstring> #include <cstdio> #include < queue>using namespace std; #define DEBUG (x) cerr << #x << "=" << x << endl;const int MAXN = 1000  0 + 10;string A1,b1;int A[MAXN], B[MAXN], C[MAXN], d;void Add (int a[], int b[], int c[], int la, int lb) {memset (A, 0,    sizeof (a));    memset (b, 0, sizeof (b));    int len = max (LA, lb), x = 0;        for (int i=1; i<=len; i++) {c[i] = A[i] + b[i] + x;        x = c[i]/10;    C[i]%= 10;    } if (x! = 0) C[++len] = x;    for (int i=len; i; i--) {cout << c[i];    }}void subt (String a1, String b1) {string C1;    memset (A, 0, sizeof (a));    memset (b, 0, sizeof (b));    BOOL FLG = false; if (A1.length () < B1.length () | | (a1.length () = = B1.length () && A1 < B1))        {c1 = a1;        A1 = B1;        B1 = C1;    FLG = true;    } if (FLG) cout << "-";    int la = A1.length (), LB = B1.length (); for (int i=0; i<la;    i++) {A[la-i] = a1[i]-' 0 ';    } for (int i=0; i<lb; i++) {b[lb-i] = b1[i]-' 0 ';    } int x = 0;        for (int i=1; i<=la; i++) {c[i] = A[i]-b[i]-X; x = (C[i] < 0)?        1:0; C[i] = (C[i] < 0)?    C[i] + 10:c[i];    } while (!c[la] && la > 1) la--;    for (int i=la; i; i--) {cout << c[i];    }}void multi (string p, string q) {memset (A, 0, sizeof (a));    memset (b, 0, sizeof (b));    int LP = P.length (), LQ = Q.length ();    for (int i=0; i<lp; i++) {a[lp-i] = p[i]-' 0 ';    } for (int i=0; i<lq; i++) {b[lq-i] = q[i]-' 0 ';    } int len = LP + lq-1;            for (int i=1, i<=lp; i++) {for (int j=1; j<=lq; J + +) {C[i+j-1] + = a[i] * B[j];            C[I+J] + = c[i+j-1]/10;        C[I+J-1]%= 10;    }} if (C[len+1] >= 1) len++;    while (!c[len] && len > 1) len--;    for (int i=len; i; i--) {cout << c[i]; }}void divi (string p, int q) {int LP = P.length (), x = 0, s = 0, tot = 0;        for (int i=0; i<lp; i++) {x = x * + p[i]-' 0 ';        if (x/q! = 0) s++;        if (s = = 0) continue;        C[++tot] = x/q;    X%= q;//x is the last remainder} for (int i=1; i<=tot; i++) {cout << c[i];    }}int Main () {cin >> A1 >> D;     Divi (A1, D); return 0;}
Cloze After you finish the problem, you must tidy up the idea check once! , because a strange problem when we are more familiar with the simulation, this time to go again not only pro, but also can find the first simulation of negligence, to avoid errors

Pay attention to the symmetric write code, and create a small data to go in and try

Fill out the program empty time to pay attention not to be given the code with crooked ... Because the code is very strange, to the end of their own may be brought also filled with strange things ... To fill in the "What needs to be done now", such as filling in the best, according to your own understanding of the algorithm, combined with the context of the blanks. My last empty because the code is so simple that I thought it was simple enough not to update the optimal solution ... In fact, according to the flow of the algorithm should be optimal, can not be brought crooked ...

Pay attention to the boundary problem, take a look to see if you can take the boundary, many times the initialization value and the title description is a bit inconsistent, especially the last empty, usually a pointer-1, this-1 is deceptive ... And often have the global variables initialized to 0 case, you have to carefully look at the characters do not conform, if an empty fill will cross the boundary, such as what I + P found will be more than n what, may be filled with the wrong, do this problem is as far as possible to fill your code in the original, there are some forms have symmetry, There are some are more special, defined a end2 = N,end2 has never changed, so fill n fill end2 are the same, but the answer is to write the end2 ... (13 blanks 1)
Pay attention to the symmetry of the blanks, for example, to determine which of the two variables to write first to if, the sequence of variable names can be seen in the previous code

The first round code often has a for without curly braces or strange operation, sometimes affect the understanding (for example, a sentence to fill in the empty in the loop what)

If you fill in the code, it will obviously be more than the boundary of the topic, even if it does not have much impact, it is also wrong, such as the last blank in 15, it is clear that 0 and 2 is the need to traverse, which can be i-1 and i+1, not to say that it does not have to traverse ...

If you see a very strange place, do not easily think that the topic is deliberately written to deceptive what, unless it is really OK, "smart is wrong"
For example 10 T1 that swap, because passed a pointer I think this is an invalid operation, but in fact, I according to the name of the swap to understand that this is the subject of the person interfering with me, if not to exchange this program output what ah ...

Read and understand a good reading problem read a good question, dig some information from the problem of dry! Do the problem when you must focus on calm and serious, do not make a low-level mistake!

Note that when reading a program, it is possible to deceptive, such as array subscripts starting from 0 to save

Find the law first, find solutions to small-scale problems, and then create a few more data to observe what the relationship, it is best to read the code to see what is done, and then to simulate
Solve the hard-to-think recursive procedure or guess what the program does, or the violence.

But violence is also a skill, such as do not use the depth of the first way to expand the search tree, it is easy to mess with a wide search of the way to expand the tree methodically, but also easy to see the law. And remember to add some memory, count the less the more not easy wrong! (17 reading T1)

In general Depth-first discovery law, breadth-first calculation results

For example, 10 reading T4, the essence is the game, but actually quite ugly out, if the breadth of the first way to expand the estimate is not complete, but if in the way of depth first, find the most special, it is easy to find that r (6) = -1,r (7) = 1, and then will find the law
But because of uncertain types, sometimes deep search instead of the law, flexible transformation is the way

Clear the meaning of the array representation and do it again.

Some issues attention to the process of image, such as the 17 reading program last question

Write recursion when note to write down various state parameters, such as I = 1,q = 3 What, do not worry about trouble, do not hurry to return, the No. 0 level of recursion to write
such as f (0,1,6) f (0,2,6), at a glance, not easily wrong

Do not "lax", there are doubts about the place must seize and then re-deduction to solve the doubts ( such as an operation is not satisfied with the Exchange law to give an example to try ), many times I made a clear mistake or because too lazy to push away the less clear place, there is the last step to do not want to do, Direct Hu wants the answer up (subconsciously), also did not consider its correctness, from the first step to the last step to be careful to do, and then go back to check again, see clearly a point!

Consciously let yourself into the state before the exam

About the mentality

Do not have a problem do not come out depressed, also do not have a problem easy to see the solution is very proud, this time is often easy to fall into the pit, such as the 13 fill in the last question the third and fourth, I according to my so-called symmetry, want to not think, analogy above the code to write a wave, and then found not to write Because the two parts of him are the same in form ... Check the time has not found this problem (at that time the mentality floated), at least also have to look carefully to think about it ...

Wrong question

When doing the problem must be careful, some of the answers a look on the wrong to think about ...

Binary to decimal when starting from 0

Do not because the preliminary test instructions simple is not very thin want to do directly, in fact, should be a problem to seriously think about the model, and how to complete this matter, with their knowledge of the serious treatment!

How many combinations can be combined with 1,1,2,4,8,8, which are combined into four-digit numbers?
Difficult to calculate, but small data can be directly enumerated combinations
My combination is listed, but the mindset, which leads me to use a (4, 4) to calculate the answer directly
in fact, every step to think about it, do not rely on the feeling of a direct multiplication of a (), since the classification, perhaps the calculation is also classified, before the ride to see if you can multiply
Because the combinations like 1 1 2 8 are all arranged, there will be duplicates and need to be divided by 2, so like 1 1 2 8, there are 12 different four-digit numbers.
In contrast 1 2 4 8 There are 24 kinds

10 reading T4
The perm function asks for the smallest dictionary order!!! I also thought for a long time multiple solution is not only one satisfies the condition, I thought the swap does not have the entire arrangement ... In fact, the perceptual understanding function is what to do, such as the perm function of the problem should be perfection arrangement, prove not come out first put it

(selected in 13) T (n) indicates the number of times an algorithm has entered a scale of N. If T (1) is constant and has a recursive t (n) = 2*t (N/2) + 2n, then T (n) = ()
A.θ (N)
b.θ (n log n)
C.θ (N2)
d.θ (n2 log n)
B
Under the perceptual understanding

(13 option 7)
The Fibonacci sequence is defined as follows: F1 = 1, F2 = 1, Fn = fn–1 + fn–2 (n≥3). If you use the following function to calculate the nth term of the Fibonacci sequence, the time complexity is ().

int F(int n) {  if (n <= 2)   return 1;  else   return F(n - 1) + F(n - 2); }

A. O (1)
B. O (N)
C. O (n2)
D. O (Fn)

In fact, a look should choose D, if you choose ABC you think of this question still use test?

A solution or something is not going to work, just think about the Cattleya number or something, try it.

(12 option 16)
It is known that the ownership value on the weighted graph G is a positive integer, and the weighted value of the shortest path from the vertex u to the vertex v is d (U, v). If v1, v2, v3, V4, V5 are vertices on figure G, and there are 22 paths between them, the following statement is correct ().

A. The shortest path from V1 to V2 may contain a ring
B. D (V1,V2) =d (V2,V1)
C. D (v1,v3) ≤d (v1,v2) +d (V2,V3)
D. If V1→V2→V3→V4→V5 is a shortest path from v1 to V5, then V2→V3→V4 is a shortest path from V2 to V4
CD Note is a graph

(09 Select 4)
In a system environment with a 16-bit word length, a 16-bit signed integer has a binary complement of 1111111111101101. Its corresponding decimal integer should be:
A. 19
B.-19
C. 18
D.-18
B
Binary minus 1, if the last one is 1, let the last one minus 1 to 0, if 0, borrow a
(I see several 16 actually put this number in 16 to expand into the 10 into the system)

5%10 = 5

Noip Preliminary Finishing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.