12 weeks (for the maximum number of books in multiple groups)
/** Copyright (c) 2014, computer College, Yantai University* All rights reserved.* File name: test. cpp* Author: Wang Zhong* Completion date: January 1, November 16, 2014* Version No.: v1.0** Problem description: calculate the maximum number of N groups;* Input Description:
gglad CD. As mentioned before, CD is relatively not flat, so CD hopes that K people will beat him the most frequently. Can you tell him how much he will be beaten in the end?
[Input format]
The first line has two positive integers, N and K.
The n positive integers in the second line indicate the number of CDs that each user wants to play.
[Output format]
Output a positive integer indicating the number of t
of an illegal sequence.The total number of sequences can be calculated like this, m+n position, select n position to fill 1, so is C (m+n,n).The number of illegal sequences is: m+n a position, select m+1 position to fill 1, so is C (m+n,m+1). And then everyone is not the same, so you need to arrange the whole m! * n!.So the final formula is: (C (M+n,n)-C (m+n,m+1)) * m! * n! Simplification is: (m+n)!* (m-n
Hit 2276 (number theory, prime number )]
[Original question link]
Http://acm-hit.sunner.cn/index.php? Option = com_wrapper Itemid = 39
(Not accurate. You need to go to hit to find the question number)
[Topic]
Number of prime numbers between input L, R output
The number of divisors (approximate) about Humble NumbersTime limit:1000MS Memory Limit:32768KB 64bit IO Format:%i64d %i64 U DescriptionA number whose only prime factors be 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, ten,, +, (+), A, ten, A, ten, ten, ... shows the first humble numbers.Now given a humble
Recently I read the number theory and re-thought about this question. I referred to the paper and the lrj black book, re-proved it, and made a note.
Example: hdoj 1792 a new change problemGiven the interconnectivity between A and B, A and B, the maximum and maximum numbers cannot be combined.
Basic knowledge:Gcd (a, B) = 1 → lcm (a, B) = ABThe remainder class, which divides all integers into M equivalence c
\cdot k$, where $p _1$ is prime and $p 5. Find the $x $, $y $, $z $ for all primes that satisfy the equation $x ^y + 1 = z$.Answer:$x ^y$ differs from $z $ parity, so $x = 2$. $$\rightarrow 2^y + 1 = z$$ If $y $ is odd, then $z $ is composite, so $y = 2$, $z = 5$.6. Proof: $n > 2$, there must be a prime number between $n $ and $n!$.Answer:Easy to know $ (n!, n!-1) = 1$. The primes in $1\sim n$ can be evenly divisible $n!$ but not divisible $n! -1$, s
Prime Test
Time limit:6000 ms
Memory limit:65536 K
Total submissions:29046
Accepted:7342
Case time limit:4000 Ms
DescriptionGiven a big integer number, you are required to find out whether it's a prime number.
InputThe first line contains the number of test cases T (1 OutputFor each test case, if n is a prime
[Hdu 4959] Poor Akagi number theory (Lucas number, quadratic field operation, proportional sequence sum)Poor AkagiTime Limit: 30000/15000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission (s): 131 Accepted Submission (s): 29Problem DescriptionAkagi is not only good at basketball but also good at math. Recently, he got a sequence Ln from h
I have read the number theory knowledge before. Now I want to find some questions .....
Poj 1061 Portal
Here, we will give you X, Y, M, N, and L. Represents the coordinate X of frog a, y of frog B, m of frog a, n of frog B, and mod value L, find the number of encounter hops. (M-N) * X0 = (x-y) (mod L); the solution of the modulus linear equation, but pay attentio
theorem 3: x is the contraction of the M, then if there is an integer with M-A,ax also the contraction of M.theorem 4: M1 m2 is a positive mode of two, then if X1 and X2 respectively over M1 and m2 of the contraction system, m1x2 + m2x1 over m1*m2.The theorem of this section 3 4 is exactly similar to the second section Theorem 1 2.theorem 5: "Euler's theorem": if (A, m) = 1, then POW (A, phi (m)) = 1 (mod m)Proof: (a x1) (a x2) ... (a XP) = X1 x2 ... xp (mod m)Pow (A, p) x1 x2 ... xp = x1
The first few catlands: C0 = 1, while
C1 = 1, C2 = 2, C3 = 5, C4 = 14, C5 = 42,
C6 = 132, C7 = 429, C8 = 1430, C9 = 4862, C10 = 16796,
C11 = 58786, C12 = 208012, C13 = 742900, C14 = 2674440, C15 = 9694845.
The following formula is used to calculate the number of catlands:
H (n) = H (n-1) * (4 * N-2)/(n + 1)
H (n) = H (0) * H (n-1) + H (1) * H (n-2) +... + H (n-1) H (0) (N> = 2)
H (n) = C (2n, N)/(n + 1) (n = 0, 1, 2 ,...)
H (n) = C (2n, n)-C (2n
Topic linksFirst of all to know a property, a number X Factor number equals A1^P1 * A2^P2*....AN^PN, AI is the X-Factor, p is the number of quality factors.And then we can search.#include #include#include#include#include#include#include#includeSet>#includestring>#include#include#includeusing namespacestd;#definePB (x) push_back (x)#definell Long Long#defineMK (x,
Number of 1
Mean: Enter n to calculate the number of integers smaller than 10 ^ N containing 1. Analyze: This is a combination of post-thinking questions in mathematics. Basic Idea: Combination of mathematical multiplication principle + rejection Principle In the n-digit number, each item can be {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}. Therefore,
Label: style blog Io color for SP Div on Log
Gcd (x, y) (1
This complexity is unacceptable,
Then, we can consider enumerating K and calculating Σ PHI (Q/K) (k is the prime number within N, and Q is a multiple of K within N), that is, Σ [PHI (1) + PHI (2) + PHI (3) +... + PHI (p)] (P = N/K)
Prefix of PHI and can be preprocessed in rough.
However, (x, y) and (Y, x) are different. Therefore, when calculating the prefix and sum, we must m
Hdu 4937 Lucky Number (Number theory), hdu4937
Link: hdu 4937 Lucky Number
Given a number of n, if the number is in base-all composed of 3, 4, 5, and 6, the base is called the lucky base of n, given n, how many lucky hexadecimal s
POJ 2739 Sum of Consecutive Prime Numbers-number theory-(continuous Prime number and), pojnumbers-
Question: How many continuous prime numbers are there and the range of n is: 2 ~ 10000
Analysis: Pre-processes the prime number in 10000, and then finds the number of sum = n
HDU1492-The number of divisors (approx.) about Humble Numbers-number theory (count problem), divisorsnumbers-
Question link: http://acm.hdu.edu.cn/showproblem.php? Pid = 1, 1492Question: give an idea of the number that only contains the prime factor, and calculate the approximate n
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.