Lightoj Beginners Problems part of the puzzle

Source: Internet
Author: User



related code please poke Https://coding.net/u/tiny656/p/LightOJ/git



1006 Hex-a-bonacci. Using the array simulation to record the results, pay attention to the modulo



1008 Fibsieve ' s fantabulous Birthday. Find the regular problem, the left column is 1 3 square 5 Square ... The bottom line is 1 2 square 4 square ..., find the current number of the location of the folder, and then handle the position relationship, note parity.



1010 kinghts in chessboard. Rule problem, for m,n greater than 2, use the method of cross-placement. In the case of min (m,n) = 1, the result is m*n. For min (m,n) = 2, the method is placed at 4 square intervals.



1042 Secret origins. Define a number, n the number of binary 1 is this value, the binary 1 number of the same number of the next. First, split into 2 binary, look for the first occurrence of 01, and then exchange the order of the two, for 010111100 of such cases, the result should be 011000111, so to move the back of 1 successive to the weight of 1 position.



1045 Digits of factorial. The number of bits of n factorial under the B-system is obtained, using Stirling formula and B^x=result. Find X is the number of digits



1053 higher Math. Three sides of the triangle, judging whether it is right triangle. Sort by edge size, 1. Pythagorean Theorem 2. The sum of the two sides is greater than the third side, and the difference between the sides is less than the third side.



1107 Calm down. Simple mathematical calculations, connecting two large centers and two small centers to form a triangle, the connection angle is  degrees, using the cosine theorem to establish the equation, you can solve the R.



1109 False ordering. The Sieve method all 1-1000 of the number, factor all out, and then sorted results. O (n^2) sieve method, sort O (nlogn), each query O (1).



1113 Discover the Web. To simulate the forward and backward access of a webpage, the steps of the algorithm have been explained in detail in the topic



1116 Ekka Dokka. Split a large number into odd numbers multiplied by even. Pay attention to x&1 judgment.



1133 Array Simulation. Simulates subtraction array operations.



1136 Division by 3. 1,12,123,1234,..., 12345678910,... This mode an = N (n+1)/2, to an in between [A, a], judge how many are divisible by 3. As long as the N or n+1 can be divisible by 3, the result can be obtained by the left and right bounded A/b operation. n is divisible by 3 quantity B/3-A/3 + ((a% 3) = = 0? 1:0), N+1 is divisible by 3 quantity (b + 1)/3-(A + 1)/3 + (((A + 1)% 3) = = 0? 1:0), note the result with long Long



1182 Parity. Calculates the number of binary 1. Multiple methods



1189 Sum of factorials. Calculates whether a given number can be represented by factorial and. Be careful not to miss out on 0!=1. Think of FAC (n) >= FAC (n-1) +...+FAC (0). For a given number that is exactly greater than FAC (n) is less than FAC (n+1), FAC (0...N-1) is less than or equal to FAC (n), so it is not possible for them to make up a given number, so we only use greedy to take the value from the large to small.



1211 intersection of Cubes. gives the diagonal coordinate (X1,Y1,Z1) of the N Box (X2,Y2,Z2), where x1<x2,y1<y2,z1<z2, which is the total intersecting volume of the N-cuboid. Start with two dimensions and then three-dimensional. Find out the maximum value of all x1,y1,z1, the minimum value of X2,Y2,Z2, the resulting is the intersection box, if not formed box, it is 0.



1214 Large Division. Take a large number of modules and note the addition overflow.



1227 boiled Eggs. n eggs take out the weight of P not more than Q, ask the most can be removed a few. Directly from the bottom of the greedy and the smallest.



1241 Pinocchio. Ah, a good pit of a problem, in fact, is to find incremental sequence, rise jumps a few times, but each jump is 1-5cm, and the initial is 2cm, for 2 8 sequence, the result jump is certainly 2, for 3 3 This, the results come up from 2->3. It would be nice to pay attention to these situations. sigh!



1249 chocolate thief. The sum divided by the number of people is the average level, enumerating everyone, greater than average is the thief, less than the average is the victim.



1305 area of a parallelogram. Find the fourth vertex and area of a quadrilateral. CX-DX = bx-ax, cy-by = Dy-ay. Then the point-to-line distance formula. H = | a*x0+b*y0+c| /sqrt (a^2+b^2). S = Lab*h can be removed below the square root can be about



1331 Agent J. Push the formula, three circles tangent, seek the middle blank area. The center structure Triangle, minus three arc area by the Triangle area. Helen Formula, find out the intersection of the angle line to the height of each side, as well as the inverse tangent function to seek the angle.



1414 February. To find the number of leap years between two dates. 2015 programming of the United States qualifying the original question. Defines the number of leap years before N, func (n) =n/4-n/100+n/400, which is to find all the years that can be divisible by 4, minus the number of years that can be divisible by 100, plus 400, which is the number of leap years before N (including N), then the number of leap year between-A is func (b)- Func (A-1). Pay attention to handling the month and day, revision year. For example, the first period of the month is greater than or equal to 3, counted as the next year. The second period of the month, if before 29 in February, is counted as last year.



Lightoj Beginners Problems part of the puzzle


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.