Problem Description There is many lamps in a line. All of the themare off at first. A series of operations is carried out on these lamps. On thei-th operation, the lamps whose numbers is the multiple of I change thecondition (on to off and off).Input Each test case contains only a number n (0Output output The condition of the n-th lamp after infinity operations (0-off, 1-on).Sample Input 15Sample Output 10HintConsider the second test case:The initial condition:0 0 0 0 0 ...After the first Operat
The least oneTime limit:9000/3000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 492 Accepted Submission (s): 184Problem Description in the RPG game ' go back Ice Age ' (I decide to develop the game after my undergraduate education), all Heros has their own respected value, and the skill of killing monsters is defined as the following rule:one hero can Ki LL the monstrers whose respected values is smaller then himself and the both respected values have none common
integer Mi, 0Output for each case, there is Q results, in each result, you should output the value of the hero you'll dispatch to C Omplete the task.Sample Input237Sample Output511AuthorwangyeSource2008 "Insigma International Cup" Zhejiang Collegiate Programming Contest-warm up (4)Recommendwangye | We have carefully selected several similar problems for you:1793 1796 1797 1794 1798 test instructions: Kill Monster game, Hero's ability to be greater than the monster, and both ability is prime, co
pockets is part of the same oil deposit if they is adjacent horizontally, vertically, or diagonally. An oil deposit won't contain more than pockets.Sample INPUT1 1 * 3 5 *@*@* **@** *@*@* 1 8 @@****@* 5 5 ****@ *@@*@ *@**@ @@@*@ @@**@ 0 0Sample Output0 1 22Sourcemid-central USA 1997Recommendeddy | We have carefully selected several similar problems for you:1016 1010 1312 1242 1240//Mark →→1#include 2#include 3 using namespacestd;4 #defineN 110;5 intm, N, I, J;6 7 intac[8][2]={{0,1},{1,1},{1,0},
Prime Ring problemTime limit:4000/2000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 28204 Accepted Submission (s): 12561Problem Descriptiona Ring is compose of n circles as shown in diagram. Put Natural number 1, 2, ..., n into each circle separately, and the sum of numbers in the adjacent circles should is a PR Ime.Note:the number of first circle should always be 1.INPUTN (0 Outputthe output format is shown as sample below. Each row represents a series of cir
relationship between inquiries, it is for the current state!OutputEach set of input data corresponds to one row of output. If you can eliminate the output "YES", you cannot output "no".Sample InputSample OutputYesnonononoyes This topic at that time to pit me an afternoon time .... The code is flawed, and there are always unexpected letters, and the most pit is that dir array elements are not the same as the wrong, ghosts know why. It's similar to the one I did before. Just BFS a search to the e
Least common multipleTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 38681 Accepted Submission (s): 21606Problem DescriptionGiven two positive integers, calculate the least common multiple of these two numbers.InputThe input contains multiple sets of test data, with only one row per group, including two positive integers not greater than 1000.OutputFor each test case, the least common multiple of these two numbers is given, and each instance ou
Box of BricksTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 5457 Accepted Submission (s): 2358Problem Descriptionlittle Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. "Look, I ' ve built a wall!", he tells his older sister Alice. "Nah, should make all stacks the same height. Then you would has a real wall. ", she retorts. After a little con-sideration, Bob sees that she was
GPA.Input contains more than one set of data, and the first row of each group of data has a number n, and the next row of n rows represents a score. Each line has two actual number S,p,s represents the course's credit, p indicates the student's score (percentile). If p=-1 The student This course lacks the examination, should not be counted. Output outputs a row for each set of data, representing the student's GPA, which retains two decimal places. If GPA does not exist, output-1.Sample Input33
1005ac+ Problem Solving Ideas
Analysis:
1, in the title (1 2, (A * f (n-1) + B * F (n-2)) MoD 7 = (a%7*f (n-1) +b%7*f (n-2))%7
3, because F (i) and F (i+1) have only 49 combinations, because (f (i), (i+1) There are only 7 options, that is, only one of the 0,1,2,3,4,5,6. Therefore, the cycle
Solving:
1, the cycle is first, by the way, the first period of F (n) to find out.
2, using the cycle, the remaining f (n) is directly obtained.
Code:
#include #define M 52
in
Eat candyTime limit:6000/3000 MS (java/others) Memory limit:65535/32768 K (java/others)Total submission (s): 27178 Accepted Submission (s): 7691Problem Descriptionhoho, finally from Speakless hand to win all the candy, is Gardon eat candy when there is a special hobby, is not like the same candy put together to eat, like to eat first, the next time to eat another, so But Gardon don't know if there is a candy-eating order so he can finish all the candies? Please write a program to help calculate
Verifying the Angle Valley conjectureTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 6653 Accepted Submission (s): 3417There are many speculations in problem description number theory that have not yet been resolved, one of which is known as the "Angular Valley conjecture", a problem that was popular in several prestigious universities in cert, the problem is described as: any one greater than the natural number, if it is odd, is multiplied by
Lowest BitTime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 9052 Accepted Submission (s): 6656Problem Descriptiongiven an positive integer a (1 For example, given a = +, we can write a in binary form as 11010, so the lowest bit of a is ten, so the output should be 2 .Another example goes like this:given a = to, we can write A in binary form as 1011000, so the lowest bit of The output should is 8. Inputeach line of input contains only an integer
Eddy ' s-ITime limit:2000/1000 MS (java/others) Memory limit:65536/32768 K (java/others)Total submission (s): 7117 Accepted Submission (s): 4268Problem Descriptioneddy ' s interest is very extensive, recently he's interested in prime number. Eddy Discover the all number owned can is divided into the multiply of prime number, but he can ' t write program, so EDD Y have to ask intelligent him, he asks you to write a program which can do the number to divided into the multi Ply of prime number fac
problem DescriptionCDFPYSW loves playing a card game called "Hearthstone". Now he had N cards, he wants to split these cards into 4 piles.Let's assume the number of cards in each pile is A1, A2, A3, A4. It must be satisfied that:a1 * K1 = a2 + a3 + a4 A2 * k2 = a1 + A3 + a4 a3 * K3 = A1 + a2 + A4 A1, a2, A3, A4 Must be positive Because cdfpysw are clever, there must be a-to split there card. Can you tell CDFPYSW?InputThe first line was an integer T, means the number of cases.Then T-lines, each
Find your present!Time limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 3096 Accepted Submission (s): 2051Problem DescriptionIn The New Year party, everybody'll get a "special present". Now it's your turn to get your special present, a lot of presents now putting on the desk, and only one of the them would be yo Urs. Each present have a card number on it, and your present ' s card number would be the one that different from all the others. For examp
A CTime limit:2000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)Total submission (s): 4206 Accepted Submission (s): 2671Problem Descriptionare You excited the title "AC"? If The answer is YES, AC it;You must learn these and combination formulas in the school. If you had forgotten it, see the picture.Now I'll give you N and M, and your task was to calculate the answer.Inputin the first line, there is a integer T indicates the number of the test cases.Then T-cases follows in the
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.