UESTC 1272 Final Pan's prime numbers, the number of questions and guess the answer.

Pan likes prime numbers very Final much. Day he want to One find the super prime numbers.A prime numbers n n>4 is a super prime number only if n-4 and n+4 are both prime. Numbers, too. Task is really easy:Give N Your find the maximum super prime number n...
Read(25) comments(0)

UESTC 1269 Speech ZhangYu pretreatment, prefix and

We all know as Octopus (vulgaris ZhangYu) has a brother very famous speech Keep some distance from me ZhangYu brother is so rich that. Want to contact he and scfkcf is one of them. One day ZhangYu brother agreed with scfkcf to contact him everyone...
Read(27) comments(0)

UESTC 653 mine simulation

Mine sweeping is a common game. Now we want to change the rules. On the n x n square map, the mine can affect all the Manhattan distance is not greater than K's location, and now gives the map of the distribution of mine, with * on behalf of the mine, using. Position to fill in the corresponding figures, said to be able to affect the location of the number of mine. In the plane, the coordinates (x1, Y1) of the point P1 with the coordinates (X2, Y2) of the point P2 of the Manhattan distance are: |x1 - x2|+|y1 - y2| Build ch[maxn][maxn] release character distribution map, ci[maxn][maxn] digital distribution map; Then there is a * on a diagonal line of the character type, is the feeling of a diamond. ...
Read(16) comments(0)

UESTC 1263 Desire of Asuna The greedy method

First of all, if it is a lot of 1, then n-1 times. If a 1 can be reduced by 1 times, but if there is a 2, then apart if they can be used, you can also reduce one, the other is the way. Then together enough to 1, to connect the chain, you can. When 1, 1, 1, 1, 1, 1, and last, it also happens to be the 1 remaining chain connection. Greedy strategy: first sort, from the smallest start, take the ring together 1. (each taking out a or to make up a 1 cost) If a[i]==0, I + +, len-- (the rest of the chain number); / / finally happened to the rest of the chain, the front of the chain is 1 also does not matter, it is a chain, processing If a[i]! =...
Read(17) comments(0)

UESTC 1262 Memory violence law

Idea is already I-1 to meet the conditions of the number, and the i-th number inside still meet, any two numbers and not and also the double-digit and equal. Ahead of the game when thought is the Fibonacci sequence, end the seniors announced FIB is not indeed at that time the author also feel data is large when the I-1 number and the i-th number will vary a lot, Can be a difference of a few hundred million (n<=52), so it is likely that the j is smaller than the number Fib I, but also to meet the conditions. At that time had always thought it was their own leakage solution, really should be a good reflection ah. Then use the method of violence is still relatively good choice, huh, huh, violence is very good. Sum[I, J] and the I said the number and the number of J. Anyway, n<=52, so the whole does not matter...
Read(22) comments(0)

The number of UESTC construction 1264 yuan

Construction of RMB Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status We all know that the Yuan's value is 1, 2, 5, 10, why is this value, we analyze the found, from 1 - 10 for each digital can by each denomination elected at least a through the addition (the change and subtraction...
Read(20) comments(0)

UESTC 1265 valuable resources

Valuable resources Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status A city should be built, give you n field coordinates x, y, ask to so much pit all pack into the urban, urban required minimum area is how much (note that the city is parallel to the axis of the square) In...
Read(16) comments(0)

UESTC 1018 Wang Zhixin term greedy method

The new term is coming, and the king has already arranged the whole term. A total of N days throughout the semester, the first I days arranged Pi things. But on the day before the opening night, Wang suddenly feel that this whole semester arrangements may not be interesting enough. A semester is interesting if and only if for any a integer I (1 < I < n), and the i-th day what number is always equal to the number of the penultimate day I. things. So Wang had to spend a certain price to change the schedule so that the whole term became interesting. Wang each operation costs a price, you can put one thing from the day ahead of time to yesterday or postponed to tomorrow. (the first day of things can not be in advance, the last day of the matter can not be postponed) How much does the king have to spend to make a semester interesting? For example, when n=3, p...
Read(29) comments(0)

UESTC 1261 is chosen by God greedy method

The game is very simple, each round, in turn will be randomly selected from the library two cards, until the end of the game. If the card is less than two cards, then the game directly to the end. Of course, one of the following 5 events occurred in each of the two cards. 1, if two tickets for hearts, namely God meet, what things will happen, it will be two cards to wash into the library. 2, if two are plum, that is, the encounter of the devil, the two demons will die, then it will take the two cards. 3, if one for hearts, one for the club, which had to contend with, God and the devil will survive death. Then God will take away the card, the devil to wash into the library. 4, if a piece of Party A, a hearts, that is, God's blessing. At this time, Party A will have two choices, he must choose one of them...
Read(37) comments(0)

UESTC 125224 point game DFS

Very good, all the things, subject,,, The 24 point is to give you a string of numbers, ask if you through the 24 add, subtract, multiply and divide bracket. Shen Ye think this is fun, decided to test you, give you four number can exchange position, can with the addition, subtraction and brackets, whether in a 24 point? Note that the division here is not an integer division, such as an example. Input The first line of the T, said the number of test data, 1 = T = 50 The next T lines, 4 positive integers A1, A2, A3, A4 of each line, said, is how much each number, 1 = AI = 13 Output For each query, if you can make up to 24 points, the output yes, otherwise the output no...
Read(26) comments(0)

UESTC 1253 n a thief, Alibaba and game strategy

Alibaba and n a thief came to a cave full of hidden gems. The cave there are m a very valuable gems, each equivalent. In order to help open the reward Robbers also have their paths, the cave door Alibaba, thieves decided to join him. The thieves decided to use the spoils a way as the spoils of the way: 1) everyone decided by a draw their numbers (1, 2, 3., n+1). 2) by the n+1 number allocation scheme, and then we vote, when and only when more than half of the people agree (including his own), according to his plan to allocate, otherwise this person will be killed. 3) after the death of n+1, by the number n to replace the n+1 number of the remaining people put forward the allocation scheme, similar to the 2 step. And so on Thieves are...
Read(25) comments(0)

UESTC 1255. The less greedy method to pick apples

N apple tree. The little yard, every autumn tree will bear an apple Fi. When mature apples, you will go to pick apples less. You little apples is very strange, up to M and pick apples. But picked apple pairwise must not from the same oak tree, ask variegate least pick how many times, in order to make each apple was off? Input The first line of the input of a number of N and M (1 = M = N = 106), representing the number of apple trees, and you pick up a little less. The number second line input N, the number of I Fi (Fi = 0 ~ 106) how many apples in this tree...
Read(23) comments(0)

UESTC 1251 Yu god codes greedy method

God is the team inside the encyclical IQ one of the great God, in his computer store he was learning something. Every day to learn to improve their level of knowledge. However, as an elder, The encyclical God is not willing to be their own learning materials to those who are too young, too simple, sometimes naive to see so as not to be them to engage in a big news. So, God gave his computer instructions Set password. Of course, he set the password is also in accordance with the basic law. This law is God himself out of order. This is the law: 1, the password consists of 2 n digits, separated by spaces, in which the number of the two numbers are s 2, is to meet the 1 conditions of the smallest number and the largest...
Read(18) comments(0)

UESTC 1256 Hao Hao likes to exercise n^2's pre processed or prefix and

1, direct violence, all the things we write simple, fast. Very likely timeout 2, the pretreatment with n^2, directly out of ans[i][j], then O (1) inquiry. At that time, the square of 2000 a 1e8 class, we are in fact,, 1e6. 3, prefix and thought When the input direct maintenance ans[I] [J], said in [, J] I appeared many times, maintenance of the before all the information to maintain this a; Then each time you ask M ans[, y scan, I]-ans[X-1 judge I] is greater than 0. Count with cott; With the prefix and the relative memory pretreatment n^2 a lot smaller, but it is clear that n^2 pretreatment to fast one...
Read(33) comments(0)

UESTC 764 Lost Christmas direct or segment tree orRMQ

Cherry in full set (Ouma Shuu (set) succeeded in preventing a Lang, repair, rescue ye pray (Yuzuriha Inori, referred to as prayer), due to the outbreak of the Apocalypse virus, king, ring on the 7th line is blocked, The school where the set is located. The blockade quickly became a sweeping, in order to defeat the government's ghost forces, to escape the blockade area, set in the school established the void kingdom. Each student has its own exclusive void, each void has a corresponding value of the corresponding attribute, the collection can each student's exclusive void taken out, and give them to use. Ordinary students can not use other people's void, but as the protagonist of the set and pray for the use of any student of void, obviously, if the set or the use of a certain void,...
Read(23) comments(0)

UESTC 1024 Chess Flying note that the 1<x<N is not a 1<=x<N simulation

Likes playing flying chess very Ye.Dong much so wants he Ye.Han to play with him. Simplify the problem we, define the rules as follows: To And Ye.Han 1.Ye.Dong both have two plane chesses. All chesses are at at point 0 the very begining. When two planes...
Read(23) comments(0)

UESTC 1019 SSRaligun sauce magic Fu Wen with the actual range of memory the most left Min1 the right Max1 to reduce the time complex

Memory the actual interval left most Min1 the right Max1, to reduce the time complexity degree but Min1 to initialize for you may be the biggest value or maximum value larger than, and Max1 is is minimum or minimum value smaller than. These also should pay attention to it, careful not to miss when problems but also to find the bug. Also make sure you are aware of when else if is overlapped with the attention (in the program play. Place). Type2+type2=type2 type3+type3=type3 type1+type1=type1 Type4+type1=type4 type4+type2=type type1+type2=type4...
Read(54) comments(0)

UESTC 1014 King and King boss The pigeon nest principle

King and King boss The Limit: 3000/1000MS Memory (Java/Others) Limit: 65535/65535KB (Java/Others), (Time) Wang and Wang are always in the boss to teach what is the United states. Today, king boss to fun game questions, he came up with a very beautiful question: "give you a containing n elements integer set A1... An, Ask if you can find a subset of it, and makes this subset can be divided by n" Heard the question after the king muse, "this is a very simple question, I can design a dynamic programming algorithm in linear time complexity in the relaxed solution.
Read(20) comments(0)

About getline (getline) (experimental) reads the left buffer directly to wrap a newline

(getline) reads the left buffer directly to wrap a newline...
Read(37) comments(0)

UESTC 58 arbitrary order matrix multiplication is simple but the optimization is to think about, but also make themselves aware of the original did not pay attention to the problem

Simple but optimized or to think about, But also make themselves aware of the original did not pay attention to the problem. 1, memset (,,); is time consuming, especially when the array of the river; 2, some do not have to set the number of zero is not always zero;...
Read(21) comments(0)
41 data a total of 3 pagesOne Two Three The Library Shadowe
    personal data
    • Visit7222 times
    • Integral:Four hundred and seventy-nine
    • Grade
    • Rank:Thousands of miles away
    • Original41
    • Reproduced:0
    • Translation:0
    • Comments:2
    ProLights Xu Jinghua
    Xu Jinghua, love funny, love the beautiful sky. Pro is program, Lights is ID, fxjh is the abbreviation of the name.
    We, we, we,
    If wrong, please. Oh, thank you,
    Latest comments