]==true ) { while( K!=0) {Sum+=K%Ten;K/=Ten; } if( Prime[Sum]!=true) {Beauty[I]=false; } }}} voidDp()///Dynamic planning idea, dp[i] that is, the number of primes 1 to I {Memset(Dp,0 ,sizeof( Dp)); for (int I=1;I1000000;I + +) { if( Beauty[I]==true) {Dp[I]=Dp[I-1]+1; } Else Dp[I]=Dp[I-1]; }}int main() { int A,B,T,_count;Findprime();Beautyprime();Dp(); while (scanf("%d",T)!=Eof) {_count=0; while (T--) {_count++;scanf("%d%d",A,B);Printf("Case #%d:%d\n",_co
Output010SourcenoiRecommendll | We have carefully selected several similar problems for you:1404 1536 1517 1524 1729 Witzov game (Wythoff game): There are two piles of various items, two people take turns From a heap or at the same time from the two piles to take the same number of items, the provisions of at least one at a time, more than open, the last to win the light.In this case it is quite complicated. We use (AK,BK) (AK≤BK, k=0,1,2,...,n) to indicate the number of items and call it the s
Problem number
Hdu
Type
Game
Distribution
Eventually
1001
5327
YES
√
1002
5328
YES
√
1003
5329
H
1004
5330
W
1005
5331
H
1006
5332
W
1007
5333
H
1008
5334
The meaning of the title is: the Rabbit casually hide in a hole, the wolf from the hole No. 0 began to find, every time to find the next is a number of M, all the holes formed ring.Input m and n, Hole is number No. 0 to n-1.The greatest common divisor of M and N is 1, and the wolf can be found in every hole. Otherwise, some holes are ignored, and those holes are safe.The following is the code for the AC:#include Copyright NOTICE: This article for Bo Master original article, without Bo Master per
hook after performing the operations.Consider the original hook is a made up of cupreous sticks.Inputthe input consists of several test cases. The first line of the input is the number of the cases. There is no more than cases.For each case, the first line contains a integer N, 1Next Q lines, each line contains three integers X, Y, 1Outputfor, print a number in a line representing the total value of the hook after the operations. Use the format in the example.Sample Input11021 5 25) 9 3Sample O
Problem description for a given string, statistics the number of occurrences of a numeric character.Input data has multiple lines, the first line is an integer n, indicating the number of test instances, followed by n rows, each containing a string consisting of letters and numbers.Output for each test instance, outputs the number of values in the string, with each output occupying one row.Sample INPUT2ASDFASDF123123ASDFASDFASDF111111111ASDFASDFASDFSample Output69Code:1#include 2#include malloc.
Nuclear reactorTime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 12219 Accepted Submission (s): 5547Problem description There are two types of events occurring in a nuclear reactor:When the high-energy particle strikes the nucleus, the particle is absorbed, releasing 3 high-energy particles and a low-energy particle.When the low-energy particle strikes the nucleus, the particle is absorbed, releasing 2 high-energy particles and a low-energy par
+ + and use __int64 against VC6AuthorUnknownSource 2006/1/15ACM Program Design Final ExamRecommendLcyAnalysis: From the No. 0 second to 1 seconds, 1 high-energy particles emit 3 high-energy particles and a low-energy particle, from the 1th second to 2nd seconds 3 high-energy particles and a low-energy particle generation (3*3+2*1) a high-energy particle, while 3 high-energy particles produce 3 low-energy particles + 1 low-energy points to produce 1*1; a[ The array contains a high-energy particl
Find the safest roadTime limit:10000/5000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 9368 Accepted Submission (s): 3308Problem Descriptionxx Planet There are many cities, each city has one or more flight lanes, but not all roads are very safe, each road has a safety factor s,s is the real number between 0 and 1 (including 0, 1), a channel p from u to V The safety is safe (P) = S (E1) *s (E2) ... *s (EK) E1,e2,ek is on the side of P, now 8600 want to go out t
A = = B?Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 64239 Accepted Submission (s): 10060Problem descriptiongive You both numbers A and B, if A is equal to B, you should print "YES", or print "NO".Inputeach test Case contains-numbers A and B.Outputfor each case, if A was equal to B, you should print "YES", or print "NO".Sample Input1 22 23) 34 3Sample OutputNoyesyesno/* The first time to do is always to understand the topic too simple. Aft
The meaning of the topic: to the point interval [a, b], find the number of K, and POJ2104, just the time limit on the Hdu 5000MS, with my method on the POJ, too, will time out.The code of this problem, change the input of the main function, you can directly AC the POJ on the 2104.This problem, with the division of the method, WR, Tangled up one night, finally gave up, really do not know where the wrong. Then the method of dividing tree was used to learn the establishment and search of the partit
This problem, similar to the decryption of ciphertext. The meaning of the topic is very clear.Give you the number of P Q e l,l for the second row.Calculate the N and FN first, and then calculate the D.n = p * q;fn = (p-1) * (q-1).Then according to the D * e% fn = 1, calculate d.The key is to seek C. The number num to you is equal to c ^ d% n. c The corresponding ASCLL code is the decrypted character.The following is the code for the AC:#include Hangzhou Elec
The recursive formula for the Catalan number is: f (n) = f (n-1) * (4*n-2)/(n + 1);Since n is the maximum of 100, it is necessary to use an array to hold each of the Catalan numbers. You need to use a large number of operations.The following is the code for the AC:# include Hangzhou Electric Acm1130--how Many Tree? Number of ~~catalan
Can you solve this equation?Time limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 11180 Accepted Submission (s): 5151Problem Descriptionnow,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 = = Y,can you find its solution between 0 and 100 ;Now try your lucky.Inputthe first line of the input contains an integer T (1Outputfor Each test case, you should just output one real number (accurate up to 4 decimal places), which is the solution of The Equati
First look at the topicThis problem, according to the meaning of the title, I understand, should be input, each group input line, and then the corresponding output, more than one blank line between the output, but the problem is how to know that he has entered the completed, the following should show the output. Misunderstood by the problem input and output case. It was then replaced by a line of output, followed by the output of the line, and then the input, output, alternating.#include using n
Simple Euler circuit, title.Euler's circuit judgment:1. In the direction graph: The first necessary condition is that the graph is connected, so the vertex's penetration is equal to the degree of the.2. In undirected graphs: the first condition or the graph is connected, followed by the vertex is even several (the degree of the vertex is even)This problem is a graph, so according to the judgment method to write, very simple, the decision does not prove.I use and check the set to determine whethe
Fibonacci AgainTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 43441 Accepted Submission (s): 20755Problem Descriptionthere is another kind of Fibonacci numbers:f (0) = 7, f (1) = one, f (n) = f (n-1) + f (n-2) (n>=2).Inputinput consists of a sequence of lines, each containing an integer n. (n Outputprint the word "yes" if 3 divide evenly into F (n).Print the word "no" if not.Sample Input0 1 2 3 4 5Sample Outputauthorleojay//7 11 18 29 47 76 12
Euler functionsEuler functions, for positive integer n, the Euler function is the number of the number of n coprime less than or equal to N.The general formula is:F (x) = x * (1-1/p1) * (1-1/p2) * ... * (1-1/PN); P1,p2,p3.....pn is the qualitative factor of X. Each quality factor occurs only once. that is p1≠p2≠....pn; for example 12 = 2 * 2 * 3;2 can only be counted once.With this Oraton-type, you can quickly solve the problem, the beginning I was done in a normal way, it is obvious that the ti
(0Outputoutput the minimum positive value that one cannot pay with given coins, one line for one case.Sample Input1 1 30) 0 0Sample Output4Authorlcyafter learning the mother function after the first hand, so that only really understand the meaning of the algorithm will knock him out and according to the specific requirements of the topic to learn the flexibility to pass. The same is the expression of the female function, and then the triple loop, the polynomial multiplication, to determine whic
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.