Question link:
Http://poj.org/problem? Id = 2299
Analysis and Summary:
When we see the first response to this question, we think it is the reverse order number = |
First use merge sort to calculate the reverse order number AC, which should be the fastest way to calculate the reverse order number, 391 Ms
Then we use a tree array, because each element ranges from 0 to a [I] To 999,999,999, which is too large
The K-largest number in the array can be obtained based on the fast sorting method. The steps are as follows:
1. Randomly select a fulcrum
2. Place the number greater than the pivot point to the left of the array. Place the number smaller than the pivot point to the right of the array. Place the pivot point to the center (left)
3. Set the length of the left part to L,
When K
When K> L, find the number (k-l) in the part recursively
When K = L, returns the Split points (that is, the fulcrum of th
T = 0: 0. 0001:0. 1; % the interval is 0.0001, indicating that the sampling frequency is 127hzx = square (2 * pI * 1000 * t ); % square wave signal N = randn (SIZE (t) with a fundamental frequency of Hz; % white noise F = x; % add white noise figure (1) to the signal; subplot, 1); plot (T, f); % plot the waveform map of the original signal ylabel ('amplitude (v) '); xlabel ('time (s )'); title ('original sign'); y = FFT (F, 1024); % perform discrete Fourier transformation on the original signal.
Label: style blog color OS ar SP file Div on
// Calculate the text content md5qbytearray gapptextchecksum (const qstring text) {qcryptographichash crypto (qcryptographichash: MD5); crypto. adddata (text. tolocal8bit (); Return crypto. result (). tohex () ;}// calculate the md5qbytearray gappfilechecksum (const qstring filepath) {qcryptographichash crypto (qcryptographichash: MD5); qfile file (filepath);
3-4 calculate the circumference and area of a rectangle
Time Limit: 1000 ms memory limit: 65536 K
Through this exercise, you can understand the definition and usage of the copy constructor. Design a rectangular rect to calculate the perimeter and area of the rectangle. Class has private data member length (length), width (width), is initialized by the constructor with the default parameter value, the fun
This article describes how to calculate the gray histogram of an image and perform binarization on the image, the binarization threshold values described in this article are all set by yourself. The threshold values set by yourself are often inaccurate, and the optimal threshold values for different images are different. So can the computer calculate the optimal threshold of the image? The answer is yes. Ne
Calculate the date after the specified business day. This function is used in recent projects to calculate the date after N working days. now we can solve the problem by thinking of the following solutions. This indicates that the workday is still used in the recent project according to the national regulations to calculate the date after N working days. now I th
how to find all of its child nodes, then we know that because you make a maximum of M-decisions at each stage (there will be fewer stone numbers than m decisions)So through M we can find the state of its successors, because each time we only use the M state, so we only have this m state, each iteration can beHow do we iterate? We are going to analyze the recursive tree, each time this m state is what state (I have to use which M state), this problem is just the regular, constantly used to
Php calculates the distance between the coordinates of Baidu Maps, and php coordinates. Php is used to calculate the distance between Baidu map coordinates. This article describes how php calculates the distance between Baidu map coordinates. For your reference, php coordinates are used to calculate the distance between Baidu map coordinates.
This article describes how php calculates the distance between B
How to use the php function to convert a string into an array and then calculate the number of arrays ?... Thank you !!! This post was last edited by u011592778 at 13:19:16
{% "22,2, 2" | explode: "," | @ count %}
Why didn't smarty get 3? How can I use smarty to get the number of split arrays?
Reply to discussion (solution)
We recommend that you use php to calculate and pass it to smarty.
We recomm
How to calculate the period-over-period ratio of an SQL statement! The number of resumes in this month minus the number of resumes in the previous month () [number of resumes in this month]-[number of resumes in the previous month] = [number of resumes in the previous month ]()
How to write SQL statements?
SELECT DATE_FORMAT (m_adddate, '% M') as month, count (m_id) as zong, DATE_FORMAT (m_adddate,' % Y') as year from job_myreceive where DATE_FORMAT
Although the 3ds file is read, The 3ds file does not contain the vertex normal. To calculate the illumination, We need to manually calculate the normal. The process is as follows:
Three non-common points form a triangle:
Calculation method: the cross multiplication between the vector AB and the vector ac generates a straight line perpendicular to the plane where the Triangle abc is located. The vertical li
It turns out that it is not a problem to calculate the date difference between the two time points until one day .... One of the developers I once coached asked me for advice. I didn't think it was very difficult. I tried to use the calendar/gregoriancalendar class for computation. It seems that the code is too complicated and I gave up. I tried for half an hour and finally came up with a sentence and wrote it to him on MSN. At that time, I felt that
The test is as follows:
Public long date2date (string sdate1, string sdate2) throws exception {Simpledateformat SDF = new simpledateformat ("yyyy-mm-dd ");Date date1 = SDF. parse (sdate1 );Date date2 = SDF. parse (sdate2 );Return date2.gettime ()/(24*60*60*1000)-date1.gettime ()/(24*60*60*1000 );}
@ TestPublic void testdate2date () throws exception {Long date = date2date ("2012-4-11", "2012-4-23 ");System. Out. println ("difference:" + date );}
It turns out that it is not a problem to
JOJ 2042 is a program comprehension question, which provides a wonderful program for calculating x ^ 3. The principle is as follows:
It can be seen from the above that the power function increases by 6 for the first time, and its initial value is 1. Therefore, you can write the program to calculate the Cube as follows:
Int f (x ){
Int c = 0, d = 1, e = 6;
While (x --){
C + = d;
D + = e;
E + = 6;
}
Reutnrn c;
}
Similarly, based on this idea, you can
-------------------------------42 countries3 personsMedium*/
Example 2: sort the content of the table name column by the last name strokes:
Create Table # T (ID int, name varchar (20 ))
Insert # T select 1, '3'Union all select 2, 'B'Union all select 3, '2'Union all select 4, '1'Union all select 5, '10'Select * from # T order by name collate chinese_prc_stroke_cs_as_ks_wsDrop table # T/* Result:ID name-------------------------------4yi2 B3 II5th1 3*/
4. Application extension of sorting rules in p
JQuery is used to calculate the price of a shopping cart.
This document describes how to use jQuery to calculate the price of a shopping cart. Share it with you for your reference. The details are as follows:
Purpose
You can modify the number of items in the shopping cart on the html interface, and change the subtotal and total prices of the items in the shopping cart.
Implementation
1. When you click to en
Poj2299 -- merge sort to calculate the number of reverse orders, poj2299 -- reverse order
/** \ Brief poj2299 ** \ param date 2014/8/5 * \ param state AC * \ return memory 4640 K time 3250 ms **/# include
UseMerge SortingSequentialNumber of reverse orders
Poj2299 Merge (merge) sort the number in reverse order, correct the error why sum is always 0; help fuel, coming soon to the provincial Competition
This assignment is incorrect.For (int j = 0; j R
Big Number Problem: Calculate the factorial of n and the factorial of n for the big number.
Question: 100!
This seems to be a simple answer, and recursive solutions are not under pressure.
int func(int n){ if(n But you will find that the question is really so simple, consider whether the integer data does not cross the border?
This is actually a big number problem!
How to express a large number? It is very direct. We will think of a string to rep
Q:
Hello, script expert! How to calculate the number of times that the word "Failure" appears in the log file? There is a problem: Because the log file writes events one by one, a very long text line is created.
-- FS
A:
Hello, FS. According to the rest of your email, your log file is similar to the following:
Failure 2/7/2006 8:25 AM Failure 2/7/2006 9:45 AM Success
2/7/2006 PM Failure 2/8/2006 AM Success 2/7/2006 PM
As you mentioned, the first thing
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.