To find the product of odd numbersTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 56573 Accepted Submission (s): 36490Problem Descriptiongive you n integers and ask for the product of all the odd numbers in them.InputThe input data contains multiple test instances, one row per test instance, and the first number of each row is n, indicating that there is a total of n for this group of data, followed by n integers, you can assume that each set o
The Euler functionTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 4559 Accepted Submission (s): 1902Problem DescriptionThe Euler function phi is a important kind of function in number theory, (n) represents the amount of The numbers which is smaller than N and coprime to n, and this function have a lot of beautiful characteristics. Here comes a very easy question:suppose is given a, B, try to calculate (a) + (a+1) +....+ (b)Inputthere is severa
which the output a is located , the number of balls in the city wherea is located,the number of times a is transferredAnalysis:Can think of is to use and check set, the first two problems are very good solution, one to find the root node another find the total number of elements in this tree, difficult is the third problem, how to ask for the number of transfers?We can set an array to record, each time to update, obviously if in the merge function to calculate the formula is very troublesome, w
-1AuthorlinleSource2008 Zhejiang University Postgraduate second-round warm-up (2)--Full true simulationObservation point: Shortest Path (DIJKSTRA,FLOYD,SPFA)Main topic: Now there are n towns M Road, give the starting point and end point, ask whether can reach, if can, find the shortest road lengthIn fact, this is a typical shortest path problem, I now Master is three methods, DIJKSTRA,SPFA and Floyd, of which Floyd is the most easy to write, but the complexity of the time is the highest, triple
Problem number
Fd
Type
Game
Distribution
Eventually
1001
5343
SAM
W
1002
5344
YES
√
1003
5345
Game
W
1004
5346
Probability
H
1005
5347
YES
√
1006
5348
YES
√
1007
5349
YES
√
1
the remaining amount on the card is greater than or equal to 5 yuan before the purchase of an item, the purchase must be successful (even if the balance is negative on the card after purchase), it cannot be purchased (even if the amount is sufficient). So we all want to try to keep the balance on the card to the minimum. One day, the canteen has n vegetables for sale, each vegetable can be purchased once.If you know the price of each vegetable and the balance on the card, ask at least how much
Number SequenceTime limit:10000/5000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 11925 Accepted Submission (s): 5440Problem Descriptiongiven-sequences of numbers:a[1], a[2], ..., a[n], and b[1], b[2], ..., b[m] (1 Inputthe first line of input is a number T which indicate the number of cases. Each case contains three lines. The first line is the numbers n and M (1 Outputfor Each test case, you should the output one line which only contain K described above. If
Fibbonacci numberTime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 17675 Accepted Submission (s): 8422Problem Descriptionyour objective for this question are to develop a program which would generate a Fibbonacci number. The FIBBONACCI function is defined as such:F (0) = 0F (1) = 1F (n) = f (n-1) + f (n-2)Your program should is able to handle values of N in the range 0 to 50.Inputeach test case consists of one, integer n in a, where 0≤n≤50. The
Problem description to find the number of n least common multiple.Input inputs contain multiple test instances, and each test instance starts with a positive integer n, followed by n positive integers.Output outputs their least common multiple for each set of test data, with one row for each test instance output. You can assume that the final output is a 32-bit integer.#include intMain(){intN,I,A,S[ -]; while(scanf("%d",N)!=Eof) {A=0; for(I=1;IN;I++) {scanf("%d",S[I]);if(AS[I])A=S[I]; } for(I
The problem is to calculate the number of lattice points inside the triangle, you can use the peak theorem, s = n + b/2-1; where S is the area of the lattice polygon, n is the number of lattice points inside the polygon, and B is the lattice point on the boundary, assuming there are two coordinates (x1, y1) (x2, y2) b = gcd (ABS (X1-X2), (Y1-y2)). The code is as follows:/*id:m1500293 lang:c++ Prog:fence9*/#include#include#includeusing namespacestd;intN, M, p;structpoint{intx, y; Point () {}, poi
Test instructions: Draw a triangle on the checkered paper to find the number of lattice points contained within the triangleBecause one of the edges is the x-axis, the first thing to think about is to figure out the corresponding mathematical function for two edges, and then enumerate the x-coordinate values for solving. But it doesn't have to be that troublesome.Pique theorem: given vertex coordinates are simple polygons of the whole point (or square lattice), the pique theorem illustrates the
Eddy ' s pictureTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 8107 Accepted Submission (s): 4106Problem Descriptioneddy begins to like painting pictures recently, he's sure of himself to become a painter. Every day Eddy draws pictures in his small, and he usually puts off his newest pictures to let his friends appreciate . But the result of it can be imagined, the friends is not a interested in its picture. Eddy feels very puzzled,in order
11 11 2 11 3 3 11 4 6) 4 11 5 10 10 5 1Input data contains multiple test instances, and each test instance input contains only one positive integer n (1Output corresponds to each input, export the Yang Hui triangle of the corresponding number of layers, separated by a space between the integers of each layer, and a blank line behind each Yang Hui triangle.Sample Input2 3Sample Output11 111 11 2 1#include intMain(){intN,I,J,A[ to][ to]; while(scanf("%d",N)!=Eof) { for(I=0;IN;I++) { for(J=0;JI;
Problem description counts the number of Chinese characters in a given text file.The input file first contains an integer n, which indicates the number of test instances, followed by the N-segment text.Output for each piece of text, outputs the number of characters in it, and the output of each test instance takes one row.[Hint:] From the characteristics of the Chinese character machine internal code to consider ~Sample input2wahaha! wahaha! This year the festival does not speak to speak only Pu
program is in the standard output. For each input data set, prints on a, "YES" if it is possible to form a committee and "NO" otherwise . There should not being any leading blanks at the start of the line.An example of program input and output:Sample INPUT2 3 3 3 1 2 3 2 1 2 1 1 3 3 2 1 3 2 1 3 1 1Sample Outputyes NOSourcesoutheastern Europe 2000Recommendwe has carefully selected several similar problems for you:1068 2444 1150 1281 1054 to find the minimum, point coverage (maximum match value)
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.