[ab initio math] 195th section counting principle

Source: Internet
Author: User

plot summary:
[Machine Xiao Wei] in the [engineer Ah Wei] accompanied by the [nine turn elixir] of the five-turn of the cultivation.
This time to study is [counting principle].

Drama Start:

Star Calendar April 25, 2016 10:22:16, the Milky Way Galaxy Earles the Chinese Empire Jiangnan Line province.
[Engineer Ah Wei] is working with [machine Xiao Wei] to study [counting principle].









<span style= "FONT-SIZE:18PX;"                    >if (1) {var r = 20;                      Config.setsector (1,10,1,1.5);                    Config.graphpaper2d (0, 0, R);                                      Config.axis2d (0, 0,180, 2.8);                  Axis set var ScaleX = 2*r, ScaleY = 2*r;                   var SpaceX = 1, SpaceY = 1;                  var XS = -10, XE = 10;                  var YS = -10, YE = 10;                    Config.axisspacing (XS, XE, SpaceX, ScaleX, ' X ');                       Config.axisspacing (YS, YE, SpaceY, ScaleY, ' Y ');          var array2d = [[0, 0]];for (var i = 2; I <=10; i+=2) {for (var j =-3; J <=3; j+=3) {Array2d.push ([I, j]);}}                  Array2d.push ([12, 0]);            Remove duplicate point var Pointarray = Removeduplicatedpoint (array2d);                        Number of non-repeating points var points = pointarray.length;            Get the distance array//format as [[Point 1 ordinal, point 2 ordinal, distance value], ...] var Distancearray = DistancesorT (Pointarray);                        The number of sides var edges = distancearray.length;            Store the side var linkedarray = [] that need to be connected;                        Number of connected edges var links = 0;                        The set of edges associated with each vertex var edgeofvertex = []; for (var i = 0; i < points; i++) {//Gets a collection of vertex-related edges edgeofve                Rtex = [];                        for (var j = 0; J < edges; J + +) {if (distancearray[j][0] = = I | |                    DISTANCEARRAY[J][1] = = i) {Edgeofvertex.push (distancearray[j]);                    }}//Based on the starting point, look for the shortest length of two edges edgeofvertex.sort (function (A, b) {                return a[2]-b[2];                                });                var choice = 3;       if (Edgeofvertex.length > Choice) {edgeofvertex = Edgeofvertex.slice (0, choice);         } Linkedarray = Linkedarray.concat (Edgeofvertex);            }//document.write (Linkedarray.join (', ') + ' <br/> ');            Linkedarray = Removeduplicatedpoint (Linkedarray);                        Links = linkedarray.length;                            document.write (Linkedarray.join (', ') + ' <br/> ');            var startPoint, EndPoint, x1, y1, x2, y2;                        Scaled var scale = Scalex/spacex;                for (var i = 0; i < links; i++) {startPoint = linkedarray[i][0];                EndPoint = linkedarray[i][1];                x1 = pointarray[startpoint][0];                y1 = pointarray[startpoint][1];                x2 = pointarray[endpoint][0];                                y2 = pointarray[endpoint][1];            Shape.vectordraw ([[X1,y1], [X2, Y2]], ' red ', scale); } shape.pointdraw (Pointarray, ' blue ', scale, 1,' oabcdefghijklmnpqrstuvwxyzabcdefghijklmnpqrstuvwxyz '); }</span>





Xiao Wei has always wanted to calculate the license plate number capacity, in order to understand why some places to limit the card.

First look at the license plate coding rules:


Representative of the location of the car at the city level code, the law is generally the case, a is the capital, B is the province's second largest city, C is
The province's third largest city, and so on. The first of the license plate is the Chinese character: the abbreviation for the province of the car account: four
Chuan is Sichuan, Beijing is Jing, Chongqing is Chongqing, Shanghai is ..., the second is in English: for the car's location
Ground to the city level code, the law is generally the case, a is the capital, B is the province's second largest city, C is the province's third largest city
City, and so forth. Then there is the post five, and this latter five is the rule, if you are the first one in the province to
The first license plate in the area, theoretically, five digits after your license plate is 00001, if you are the No. 8965 owner, your car
The first five bits of the card should theoretically be 08965, if the license plate exceeds the number of the capacity is the 1 billionth place, from
The first bit begins with the letter A, followed by 0001 to 9999, the first bit after use is changed to B and then 0001 to 9999, and so on
, that is, if the license plate number is more new, the front of the English letter, the more the new, it is a
Like the law. The yellow grade represents the cart, the Blue card represents the car, the black label represents the foreign-funded company or the embassy, the military vehicle
The grades are compiled according to the army, not the same as the local cars, but they are all white red characters, police cars and local cars to compile the Basic Law
The same, but the last digit is not a number but changed to a red warning word.


This is the preliminary estimate of Xiao Wei:


<span style= "FONT-SIZE:18PX;" > #省名 + City code + 5 digits, and the first digit can be used with the letter # does not consider the case of the letter reservation >>> 36*9999359964# The second digit can also use letters >>> 26*26*999+99999775323# The two letters in the latter five digits can be placed at will, but must be in continuous >>> 4*26*26*999+999992801295# five digits after two letters can be placed freely, and can be discontinuous >>> 10*26*26*999+ 999996853239</span>

This means that if the above restrictions are met, a city can have a maximum of less than 7 million cars.

If the city area is 1000 square kilometers, there will be 7,000 cars per square kilometer.

You can always see the car at any stop.


It's just that the calculation actually doesn't make any sense, it's not a matter of licensing ...




<span style= "FONT-SIZE:18PX;"  >>>> [[1, 2, 3, 4], [1, 2, 4, 3], [1, 3, 2, 4], [1, 3, 4, 2], [1, 4, 2, 3], [1, 4, 3, 2], [2, 1, 3, 4], [2, 1, 4, 3], [2, 3, 1, 4], [2, 3, 4, 1], [2, 4, 1, 3], [2, 4, 3, 1], [3, 1, 2, 4], [3, 1, 4, 2], [3, 2, 1, 4], [3, 2, 4, 1], [3 , 4, 1, 2], [3, 4, 2, 1], [4, 1, 2, 3], [4, 1, 3, 2], [4, 2, 1, 3], [4, 2, 3, 1], [4, 3, 1, 2], [4, 3, 2, 1]]def Perm (ARRA Y):    if (len (array) <=1):        return [array];    r = [];    For I in range (len (array)):        #抽去array [i]        s = array[:i]+array[i+1:];        p = Perm (s);        For x in P:            #array [i] pinned            r.append (array[i:i+1]+x);    Return r;def tmp ():    print (perm ([1,2,3,4]));</span>



<span style= "FONT-SIZE:18PX;" > #排列公式def arrangement (N, m):    if n < m:        return arrangement (M, n);    else:        factorial = 1;        For I in range (n, n-m,-1):            factorial*=i;        return factorial;    def tmp ():    Print (Arrangement (4));    Print (Arrangement (5));    Print (arrangement)/arrangement (in);</span>


<span style= "FONT-SIZE:18PX;" >>>> 182648def tmp ():    print (Arrangement (14,2));    Print (9*arrangement (9,2));</span>




<span style= "FONT-SIZE:18PX;" >>>> 45.090# permutation formula def arrangement (N, m):    if n < m:        return arrangement (M, n);    else:        factorial = 1;        For I in range (n, n-m,-1):            factorial*=i;        return factorial; #组合公式def combination (n, m):    if (n < m):        return combination (m, n);    else:        return arrangement (N, m)/arrangement (m,m);    def tmp ():    print (combination (10,2));    Print (arrangement (10,2));</span>




<span style= "FONT-SIZE:18PX;" >>>> [64.0, -192.0, 240.0, -160.0, 60.0, -12.0, 1.0] #排列公式def arrangement (n, m):    if n < m:        return AR Rangement (M, n);    else:        factorial = 1;        For I in range (n, n-m,-1):            factorial*=i;        return factorial; #组合公式def combination (n, m):    if (n < m):        return combination (m, n);    else:        return arrangement (N, m)/arrangement (m,m);    def tmp ():    a = [2,-1];    N = 6;    coefficient = [];    For I in Range (n+1):        coefficient.append (a[0]** (n-i) *a[1]**i*combination (N, i));    Print (coefficient);</span>




<span style= "FONT-SIZE:18PX;" >>>> [1.0, 14.0, 84.0, 280.0, 560.0, 672.0, 448.0, 128.0]def tmp ():    a = [1, 2];    N = 7;    coefficient = [];    For I in Range (n+1):        coefficient.append (a[0]** (n-i) *a[1]**i*combination (N, i));    Print (coefficient);>>> [1.0, -9.0, 36.0, -84.0, 126.0, -126.0, 84.0, -36.0, 9.0, -1.0]def tmp ():    a = [1,-1];    N = 9;    coefficient = [];    For I in Range (n+1):        coefficient.append (a[0]** (n-i) *a[1]**i*combination (N, i));    Print (coefficient);</span>


The end of this section, to know how to funeral, please see tell.


[ab initio math] 195th section counting principle

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.