 erlang的【put,get】问题

Data = Req:parse_post(),
Uid = list_to_binary(proplists:get_value("uid", Data)), %调试打印出来的是74Uid2 = put(74,111),
Topid = get(Uid), %undefined
Topid2 = get(74), %输出111为什么Topid = get(Uid), %undefined
这句得不到111呢？？
Jinyuetuan Puzzle 谜题的问题_course
20200306Problem Description JinYueTuan is a famous online game which has been in vogue for a long time. Large number of players put themselves in it day after days… JinYueTuan is a simple game with these rules: Only seven keys on the keyboard will be used in games, each key are assigned to one of the seven sound tracks. During the game, a series of notes may fall in each sound track irregularly. When notes fall down in one sound track, player should press the assigned key at once. If so, then got a “Cool”, or get “Miss” otherwise. There are two types of “Note”: “single note” and “strip note”. Just as the name implies, “single note” means a single note, press right key at the right time once, then you can get a “Cool”, otherwise “Miss”; “strip note” needs you keeping press the corresponding key from the start time to the end time of the note. Press key at the begin time you may get a “Cool”, and release at the end time to get another “Cool”, you will “Miss” either early or late. If “Miss” at the begin time, then “Miss” the other (the end time) immediately. People lament about the fact that such an easy game is limited by the hardware design, the socalled “keys confliction”. “keys confliction” means some key combinations cannot be pressed. For example, when Track 1,4,5,6 fall a note at the same time respectively, we should press the four keys at the same time, but now, keys confliction may happen, and cause this to fail, then you will “Miss” all these four notes. Keys confliction meets the relation of inclusion, in other words, if keys set S would cause the confliction, so would keys set T when S is included in T. Note that, if at a certain moment in time, some keys should be pressed and some pressing keys should be released, then you can release and press at the same time, and released keys won’t cause any keys confliction at all. Because of the keys confliction, we have to give up some notes to save as more other notes as possible. More details will be explained in the sample data. Now you know the falling time and type (single or strip) of each note in each sound track, and all keysassembling that may cause confliction. Your task is to calculate the maximum number of “Cool” that player can get. Input There are multiple test cases, the number of them T is given in the very first line, followed by T cases. For each test case: First line contains an integer N, the length of the music (1≤N≤1000). The next 7 lines will contain description of each sound track. The first number in each line, C, denote the number of notes in that sound track. Following C description of each note: A single number “A” denotes an single note at Time A(1≤A≤N); A pair of integers separating by ‘’,”AB” denotes a strip note start at Time A and end at Time B(1≤A<B≤N). In each sound track, no superposition exists, no strip starts at another’s end time, no single notes puts in a strip(includes begin and end point). The next line contain a single integer K (0≤K<27), denotes K descriptions of Keys Confliction are following. Each description is a single line containing a string of seven characters S0 S1 S2…S6, if Sk1,Sk2,…,Sks were character ‘1’ and others were ‘0’, that means key combination Sk1Sk2…Sks may cause Keys Confliction. Output For each test case, output one line containing integer P with case number, the maximum number of “Cool” players can get. Sample Input 3 6 3 1 3 4 2 1 25 2 3 6 0 0 0 0 1 1110000 6 3 1 3 5 2 1 25 2 5 6 0 0 0 0 1 1110000 6 1 1 1 13 1 1 0 0 0 0 1 1110000 Sample Output Case #1: 7 Case #2: 8 Case #3: 3
Golden Eggs 金蛋的问题_course
20200314Problem Description There is a grid with N rows and M columns. In each cell you can choose to put a golden or silver egg in it, or just leave it empty. If you put an egg in the cell, you will get some points which depends on the color of the egg. But for every pair of adjacent eggs with the same color, you lose G points if there are golden and lose S points otherwise. Two eggs are adjacent if and only if there are in the two cells which share an edge. Try to make your points as high as possible. Input The first line contains an integer T indicating the number of test cases. There are four integers N, M, G and S in the first line of each test case. Then 2*N lines follows, each line contains M integers. The jth integer of the ith line Aij indicates the points you will get if there is a golden egg in the cell(i,j). The jth integer of the (i+N)th line Bij indicates the points you will get if there is a silver egg in the cell(i,j). Technical Specification 1. 1 <= T <= 20 2. 1 <= N,M <= 50 3. 1 <= G,S <= 10000 4. 1 <= Aij,Bij <= 10000 Output For each test case, output the case number first and then output the highest points in a line. Sample Input 2 2 2 100 100 1 1 5 1 1 4 1 1 1 4 85 95 100 100 10 10 10 10 100 100 Sample Output Case 1: 9 Case 2: 225
Dolphin 海豚的问题_course
20200216Problem Description Dolphins are marine mammals that are closely related to whales and porpoises. They might have some kind of the biggest brains in the water, but are dolphins really smart? Some scientists say that they use their big brains to stay warm in the sea, rather than for lots of thinking. Obviously those scientists don’t think dolphins are smart. We know that the brain is made up of two types of cells – neurons and glia. Neurons do the thinking, while glia do things like keeping the brain warm to help the neurons. After looking at how dolphins’ brains are put together, they claim that dolphins have lots of glia and not many neurons. In order to find out how smart the dolphins are, we throw one of them into a maze we've just created, to see how long it'll take the dolphin to get out. The maze consists of nodes and bidirectional edges connecting them. The dolphin needs power to swim, so we place exactly one fish at each node for him to enjoy. The dolphin is not interested in eating the same kind of fish more than once, but he can't resist any food if it's just in front to him! As a result, the dolphin decided to PLAN a route before going, so that it will not REACH any kind of fish more than once. Given the information above, can you tell me the minimum time that the dolphin needs to get out? Input The first line consists of an integer T, indicating the number of test cases. The first line of each case consists of four integers N, M, S and E, indicating the number of nodes, the number of edges, the starting node and destination. Each of the next M lines consists of three integers U, V, C, indicating that there is an edge with length C between node U and V. It will take a dolphin C time to pass this edge. The next line consists of N integers. Ki indicates the label of which kind fishes ith node has. Output Output the minimum time that a dolphin needs to get to the destination on a single line. If a dolphin can never get to the destination, please output 1. Constraints 0 < T <= 20 2 <= N <= 100; 0 <= M <= 10000; 0 <= S, E < N 0 <= U, V < N; 0 < C <= 1000 0 <= Ki < 1000 There may be more than one edge between two nodes, and may be loop, an edge that begins and ends both on the same vertex. All edges are bidirectional. Sample Input 2 2 1 0 1 0 1 1 0 0 4 4 0 3 0 1 1 1 3 1 0 2 2 2 3 2 0 0 1 2 Sample Output 1 4
Jinyuetuan Puzzle 程序问题_course
20191230Problem Description JinYueTuan is a famous online game which has been in vogue for a long time. Large number of players put themselves in it day after days… JinYueTuan is a simple game with these rules: Only seven keys on the keyboard will be used in games, each key are assigned to one of the seven sound tracks. During the game, a series of notes may fall in each sound track irregularly. When notes fall down in one sound track, player should press the assigned key at once. If so, then got a “Cool”, or get “Miss” otherwise. There are two types of “Note”: “single note” and “strip note”. Just as the name implies, “single note” means a single note, press right key at the right time once, then you can get a “Cool”, otherwise “Miss”; “strip note” needs you keeping press the corresponding key from the start time to the end time of the note. Press key at the begin time you may get a “Cool”, and release at the end time to get another “Cool”, you will “Miss” either early or late. If “Miss” at the begin time, then “Miss” the other (the end time) immediately. People lament about the fact that such an easy game is limited by the hardware design, the socalled “keys confliction”. “keys confliction” means some key combinations cannot be pressed. For example, when Track 1,4,5,6 fall a note at the same time respectively, we should press the four keys at the same time, but now, keys confliction may happen, and cause this to fail, then you will “Miss” all these four notes. Keys confliction meets the relation of inclusion, in other words, if keys set S would cause the confliction, so would keys set T when S is included in T. Note that, if at a certain moment in time, some keys should be pressed and some pressing keys should be released, then you can release and press at the same time, and released keys won’t cause any keys confliction at all. Because of the keys confliction, we have to give up some notes to save as more other notes as possible. More details will be explained in the sample data. Now you know the falling time and type (single or strip) of each note in each sound track, and all keysassembling that may cause confliction. Your task is to calculate the maximum number of “Cool” that player can get. Input There are multiple test cases, the number of them T is given in the very first line, followed by T cases. For each test case: First line contains an integer N, the length of the music (1≤N≤1000). The next 7 lines will contain description of each sound track. The first number in each line, C, denote the number of notes in that sound track. Following C description of each note: A single number “A” denotes an single note at Time A(1≤A≤N); A pair of integers separating by ‘’,”AB” denotes a strip note start at Time A and end at Time B(1≤A<B≤N). In each sound track, no superposition exists, no strip starts at another’s end time, no single notes puts in a strip(includes begin and end point). The next line contain a single integer K (0≤K<27), denotes K descriptions of Keys Confliction are following. Each description is a single line containing a string of seven characters S0 S1 S2…S6, if Sk1,Sk2,…,Sks were character ‘1’ and others were ‘0’, that means key combination Sk1Sk2…Sks may cause Keys Confliction. Output For each test case, output one line containing integer P with case number, the maximum number of “Cool” players can get. Sample Input 3 6 3 1 3 4 2 1 25 2 3 6 0 0 0 0 1 1110000 6 3 1 3 5 2 1 25 2 5 6 0 0 0 0 1 1110000 6 1 1 1 13 1 1 0 0 0 0 1 1110000 Sample Output Case #1: 7 Case #2: 8 Case #3: 3
Dirt 的问题_course
20200126Problem Description  Hello, may I speak to Petrov, please? Hello, my darling... You know, there was a little accident at our home... No, no, don't worry, your computer was not damaged. It is only a bit dirty there now. Well, I should say it's very dirty there and I'm at my Mom's now. Of course, I'll clean it... When? Well, maybe when I have my vacation. What? Well, when we are back from Turkey... the next vacation then. I'll stay at Mother's until then, and you may live here also. No, no, I don't insist, sure, you may stay at home if you wish so. I prepared boots for you, they are at the door. But please, don't make it worse, before you step on a clean floor, change your boots, put on your slippers, they are at the door also. Take them with you when you walk through the dirt. And when you walk on a clean floor, take the boots with you. You see, the dirt is in different places. OK, my love? Thank you! It is not a great pleasure to change boots each time you get from a clean floor to a dirty floor and vice versa, it's easier to walk extra several meters. So it is necessary to find a way of getting from one place in the apartment to another with the minimal possible number of boots changes; and among these paths the shortest one must be found. To begin with, it is natural to determine an optimal way of passing the Most Important Route: from the computer to the refrigerator. Input The first line of the input contains two integers M and N, which are dimensions of the apartment (in meters), 1 ≤ N, M ≤ 1000. The two integers in the second line are the coordinates of the computer, and the third line contains the coordinates of the refrigerator. Each of the following M lines contains N symbols; this is the plan of the apartment. On the plan, 1 denotes a clean square, 2 denotes a dirty square, and 0 is either a wall or a square of impassable dirt. It is possible to get from one square to another if they have a common vertex. When you pass from a clean square to a dirty one or vice versa, you must change shoes. The computer and the refrigerator are not on the squares marked with 0. The upper left square of the plan has coordinates (1, 1). Output You should output two integers in one line separated with a space. The first integer is the length of the shortest path (the number of squares on this path including the first and the last squares) with the minimal possible number of boots changes. The second number is the number of boots changes. If it is impossible to get from the computer to the refrigerator, you should output 0 0. Sample Input 3 7 1 1 3 7 1200121 1212020 1112021 Sample Output 8 4
Counting Problem 技术问题_course
20200126Problem Description See the 2 X 2 board above. AekdyCoin gets a N X N chessboard recently. But he think the color of the chessman is too dull (Only White and Black!).So AekdyCoin buys different kind of chessmen with different color, say blue, pink, yellow …Now AekdyCoin buys K kind of chessmen with different color, and the number of each kind is exactly Ai. Now AekdyCoin begins to play with these chessmen. He wants to put all the chessmen he bought on the board, and of course every grid could only contain one single chessman.The Figure 2 shows a valid situation ,in this figure, AekdyCoin bought two kind of chessmen and the number of each is one. As we know, AekdyCoin is very clever. So he think about this question:What is the number of ways he could put all chessmen he bought on the N X N board? After a several seconds , AekdyCoin gets a perfect idea about how to solve this problem. What about you? Two situation are regard the same in Figure 3, but the different in Figure 4. But the ways that you can get by flip or circumrotate is not regard as the same! Input The input consists of several test cases, but no more than 20. There are two integers N, M in the first line of each case indicate the size of the board and M. You should output the remainder of answer after divided by M. (1<=N <=5000, 1<=M<=2*10^9) The next line contain only one integer K indicates the kind of the chessmen AekdyCoin bought. (1<=k<=100) Then the next line has exactly K integer where the ith integer Ai indicate the number of the ith kind of chessmen AekdyCoin bought.(1<=Ai<=5000) Output Output a single line indicates the reaminder of answer after divided by M. Sample Input 2 100 1 1 2 100 1 2 Sample Output 4 6
Matrix Again 的问题_course
20191203Problem Description Starvae very like play a number game in the n*n Matrix. A positive integer number is put in each area of the Matrix. Every time starvae should to do is that choose a detour which from the top left point to the bottom right point and than back to the top left point with the maximal values of sum integers that area of Matrix starvae choose. But from the top to the bottom can only choose right and down, from the bottom to the top can only choose left and up. And starvae can not pass the same area of the Matrix except the start and end.. Do you know why call this problem as “Matrix Again”? AS it is like the problem 2686 of HDU. Input The input contains multiple test cases. Each case first line given the integer n (2<=n<=600) Then n lines, each line include n positive integers. (<100) Output For each test case output the maximal values starvae can get. Sample Input 2 10 3 5 10 3 10 3 3 2 5 3 6 7 10 5 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9 Sample Output 28 46 80
Bomb Game 的问题_course
20200107Problem Description Robbie is playing an interesting computer game. The game field is an unbounded 2dimensional region. There are N rounds in the game. At each round, the computer will give Robbie two places, and Robbie should choose one of them to put a bomb. The explosion area of the bomb is a circle whose center is just the chosen place. Robbie can control the power of the bomb, that is, he can control the radius of each circle. A strange requirement is that there should be no common area for any two circles. The final score is the minimum radius of all the N circles. Robbie has cracked the game, and he has known all the candidate places of each round before the game starts. Now he wants to know the maximum score he can get with the optimal strategy. Input The first line of each test case is an integer N (2 <= N <= 100), indicating the number of rounds. Then N lines follow. The ith line contains four integers x1i, y1i, x2i, y2i, indicating that the coordinates of the two candidate places of the ith round are (x1i, y1i) and (x2i, y2i). All the coordinates are in the range [10000, 10000]. Output Output one float number for each test case, indicating the best possible score. The result should be rounded to two decimal places. Sample Input 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 Sample Output 1.41 1.00
Tango Tango Insurrection 交错问题_course
20190830Description You are attempting to learn to play a simple arcade dancing game. The game has 4 arrows set into a pad: Up, Left, Down, Right. While a song plays, you watch arrows rise on a screen, and when they hit the top, you have to hit the corresponding arrows on the pad. There is no penalty for stepping on an arrow without need, but note that merely standing on an arrow does not activate it; you must actually tap it with your foot. Many sequences in the game are very fastpaced, and require proper footwork if you don't want to tire yourself out. Write a program to determine the easiest way to execute a certain sequence of arrows. We will work with a basic time unit of an eighthnote. At any given time, your left foot and right foot will each be on distinct arrows. Only one foot may perform an action (changing arrows and/or tapping) during any time unit; jumping is not allowed. Also, you must remain facing forward in order to see the screen. This puts limitations on which feet you can use to hit which arrows. Finally, hitting two arrows in a row with the same foot ("doubletapping") is exhausting, because you can't shift your weight onto that foot. Ideally, you want to alternate feet all the way through a string of consecutive arrows. Performing an action with a foot costs 1 unit of energy if it did NOT perform an action in the previous time unit. If it did, then it costs 3 units if it doesn't change arrows, 5 units if it moves to an adjacent arrow, and 7 units if it moves directly across the pad (between Up and Down, or Left and Right). Under normal circumstances, you can't put your left foot on Right, or your right foot on Left. However, you CAN do a temporary "crossover": if your left foot is on Up or Down, you can twist your hips and put your right foot on Left  but until your right foot moves away, you can't move your left to a different arrow. (Imagine the tangle your legs would get into if you tried!) Similarly, you can cross your left foot over/behind your right. Input You will be given multiple arrow sequences to provide foot guides for. Every sequence consists of a line containing from 1 to 70 characters, representing the arrow that must be hit at each time unit. The possible characters are U, L, D, and R, signifying the four arrows, or a period, indicating that no arrow need be hit. Assume that your left and right feet start on the Left and Right arrows for the first time unit of a sequence. There are at most 100 sequences. Input is terminated by a line consisting of a single #. Output For each input sequence, output a string of the same length, indicating which foot should perform an action at each time step, or '.' if neither does. If there are multiple solutions that require minimal energy, any will do. Sample Input LRLRLLLLRLRLRRRRLLRRLRLDU...D...UUUUDDDD # Sample Output LRLRLLLLRLRLRRRRLLRRLRLRL...R...LLLLRRRR
Science! 科学的问题_course
20200212Problem Description Welcome, ladies and gentlemen, to Aperture Science. Astronauts, War Heroes, Olympians — you’re here because we want the best, and you are it. That said, it’s time to make some science. Now, I want each of you to stand on one of these buttons. Well done, we’re making great progress here. Now let’s do it again. Oh, come on  don’t stand on the same button! Move, people! No, no, that button’s only for the Astronauts, you know who you are. What?! You say you can’t do everything I ask? Ok let’s start over. You there, the Programmer, figure out how many times we can do this. And make it quick, we have a lot more science to get through… Input There will be several test cases in the input. The first line of each case will contain n (2≤n≤80) giving the number of people (and the number of buttons) in the experiment. The next n lines will contain n characters each. If the jth character of the ith line is Y it indicates that the ith person can stand on the jth button (it is N otherwise). The last line of input will be a 0. Output For each test case, output k, the maximum number of times everyone can be standing on buttons such that nobody stands on the same button more than once (This might be 0). After that, output k lines. Each line should contain n integers separated by single spaces, where the ith integer describes which person is standing on the ith button. All of the lines should be valid and none of them should put the same person on the same button as a previous line of the same test case. Output no extra spaces, and do not separate answers with blank lines. Note that correct outputs might not be unique. Sample Input 3 YYY NYY YNY 2 YN YN 0 Sample Output 2 3 1 2 1 2 3 0
Walking the Plank 遍历的问题_course
20200116Problem Description A bunch of pirates have successfully conquered a commercial vessel. The ship itself is too badly damaged, so the entire shipload needs to be transferred to the pirate ship. The pirates have anchored a plank to both ships, which the pirates can use to go from one ship to the other, but it can only support one pirate at a time. Each pirate executes the following routine: 1. Walk across the plank from the pirate ship to the commercial ship 2. Pick up an item from the cargo hold and return to the plank 3. Cross the plank back to the pirate ship with the item 4. Put the item in the cargo hold and return to the plank Each of these four steps takes a given amount of time for each pirate. Every pirate will repeat these steps until the number of pirates on the commercial ship equals the number of items there (i.e. there's nothing more for the pirate to collect). If a pirate gets to the plank and it's in use by another pirate, he will wait at his side of the plank. When the plank is vacated and there are pirates on both sides of the plank, the pirates on the side of the commercial vessel (carrying some item) will get to go first. At both sides of the plank, the pirates queue up, i.e. the first one to get there will be the first one to cross. Should two or more pirates arrive at the same side of the plank at the exact same time, the pirate who was slowest (i.e. the one who has taken the most time to and from the cargo hold on this ship) gets to go first.Can you determine how long it takes before the last pirate has crossed the plank with the last item? Input The first line of the input contains a single number: the number of test cases to follow. Each test case has the following format: 1.One line with two integers N and P, satisfying 1 <= N <= 100,000 and 1 <= P <= 1,000: the number of items on the commercial vessel and the number of pirates, respectively. 2.P lines, each with 4 integers t1 through t4, satisfying 1 <= ti <= 1,000: the time in seconds it takes this pirate to complete each step (as listed above). At the start, all pirates are queued up at the plank on the pirate ship in the order given in the input (the first pirate is the first to cross over). Output For every test case in the input, the output should contain one integer on a single line: the time in seconds between the time the first pirate starts crossing the plank and the time the last pirate has crossed the plank carrying the last item. Sample Input 3 3 3 10 3 10 3 10 3 10 3 10 3 10 3 3 2 10 10 10 10 1 9 1 8 3 2 3 2 3 6 4 2 5 5 Sample Output 63 50 24
My World Cup 比分的问题_course
20200117Problem Description My World Cup is a fantastic board game. In this game, controlled by two players respectively, two different soccer teams meet each other in World Cup final. So, both sides are trying their best to win. Alice and Bob are addicted to My World Cup recently. They always play together. Alice wants to figure out the probability of her winning. She turns to you for help. First of all, you must be familiar with the special dice and cards for My World Cup. The dice is sixsided. Two faces have a ball on them, while the other four faces do not. Dice is an important accessory for My World Cup. There are many cards in My World Cup. Each card belongs to one of four types: foul, offense, defense, and attack. As well, each card has speed and power. When two cards from different sides meet, both of them may take some effect, which depends on both cards' type: No matter your side is home or away, 1. If your card is an offense: If the other card is a foul, your card has no effect. Otherwise, your team can have a shoot of your card’s power. A shoot of power k means that you can throw the dice for k times (or do nothing while k is less or equal to zero) . If a ball on the dice is face up for one or more times, your team will score one goal; otherwise, you get nothing. But please note that if the other card is a defense, then before your shoot, your card's power will be reduced by the defense card's power. 2. If your card is a defense: If the other card is an attack, you will make a rapid counterattack. In the rapid counterattack, your team will have a shoot of your card’s power minus the attack card’s power. 3. If your card is an attack: Assume that your card’s power is P1 and the other card’s power is P2. If the other card is a foul, your card will have no effect. If the other card is a defense, your team will score max{ P1P2,0} goals. Otherwise your team will score P1 goals. 4. If your card is a foul: You must throw a dice. If a ball on the dice is face up, your opponent will gain a penalty kick(A penalty kick is regarded as a shoot of power 3); otherwise, your card has no effect. The game's process in detail is going to be explained below. 1. Preparation: (1) One player is decided to be home and the other is away. (2) Each player has five cards, four are on the field, one is off the field. 2. During each turn: (1) Each player selects one card with the largest speed value on his own field. If two or more cards meet the conditions, he can choose anyone among them. (2) Choose the one with larger speed value among two cards selected from step (1) to be the main card. If two cards have the same speed, the one comes from the home team will be chosen. (3) The owner of the main card can choose one card as the subordinate card among the cards in the opponent's field( including the card selected from step(1) by the opponent). (4) The main card and the subordinate card meet each other and both take their effects. (5) Both the main card and the subordinate card are removed from the field. 3. After four turns, there is no card on the field. At this time, if a team scores more goals than the other, the victory are theirs. However, if both teams score an equal number of goals, an extra time will be added  each player should put his last card on the field, and the game continues for one more turn. 4. If the game ends as a draw even after the extra time, well, an exciting penalty shootout is used to determine the winner: (1) Teams take turns to take penalty kicks, until each has taken five kicks. However, if one side has scored more goals than the other could possibly reach with all of its remaining penalty kicks, the shootout ends immediately. (2) If the teams still have scored an equal number of goals at the end of these five rounds of penalty kicks, sudden death rounds of one penalty kick each are used, until one side scores and the other does not. (3) The team scores more goals at last is the winner. Now, give you the full information of Alice's and Bob's cards, can you calculate the probability of Alice's winning while both of them are taking optimal strategy to win the game. Note that Alice is always home. Input The input begins with a line containing an integer T (1 <= T <= 30), the number of test cases. Each test case contains 10 lines. Each line contains three integers t, s and p (0 <= t <= 3, 1 <= s <= 10, 0 <= p <= 9) indicating a single card's information  t is the type (0 for foul, 1 for offense, 2 for defense, and 3 for attack), s is the speed, and p is the power of the card. The first five cards belong to Alice (first four are on the field and the fifth is off the field), and the last five cards belong to Bob (also first four are on the field and the fifth is off the field initially). Output For each test case, you just need to print the probability of Alice's winning as a percentage in one line (rounded to the nearest integer). Sample Input 2 1 6 4 3 6 1 2 7 3 3 5 1 0 9 0 2 5 5 3 3 2 2 6 4 3 3 2 2 5 5 3 6 1 3 6 1 3 6 1 3 6 1 3 6 2 3 6 1 3 1 3 3 6 1 3 6 1 3 6 1 Sample Output 4 0
编程的字母的问题，BWT_course
20190827Problem Description When the problem to match S string in T string is mentioned, people always put KMP, AhoCorasick and Suffixarray forward. But Mr Liu tells Canoe that there is an algorithm called Burrows–Wheeler Transform(BWT) which is quite amazing and highefficiency to solve the problem. But how does BWT work to solve the matching SinT problem? Mr Liu tells Canoe the firstly three steps of it. Firstly, we append the ‘$’ to the end of T and for convenience, we still call the new string T. And then for every suffix of T string which starts from i, we append the prefix of T string which ends at (i – 1) to its end. Secondly, we sort these new strings by the dictionary order. And we call the matrix formed by these sorted strings Burrows Wheeler Matrix. Thirdly, we pick characters of the last column to get a new string. And we call the string of the last column BWT(T). You can get more information from the example below. Then Mr Liu tells Canoe that we only need to save the BWT(T) to solve the matching problem. But how and can it? Mr Liu smiles and says yes. We can find whether S strings like “aac” are substring of T string like “acaacg” or not only knowing the BWT(T)! What an amazing algorithm BWT is! But Canoe is puzzled by the tricky method of matching S strings in T string. Would you please help Canoe to find the method of it? Given BWT(T) and S string, can you help Canoe to figure out whether S string is a substring of string T or not? Input There are multiple test cases. First Line: the BWT(T) string (1 <= length(BWT(T)) <= 100086). Second Line: an integer n ( 1 <=n <= 10086) which is the number of S strings. Then n lines comes. There is a S string (n * length(S) will less than 2000000, and all characters of S are lowercase ) in every line. Output For every S, if S string is substring of T string, then put out “YES” in a line. If S string is not a substring of T string, then put out “NO” in a line. Sample Input gc$aaac 2 aac gc Sample Output YES NO
Isabella's Message 消息的问题_course
20200117Problem Description Isabella and Steve are very good friends, and they often write letters to each other. They exchange funny experiences, talk about people around, share their feelings and write about almost everything through the letters. When the letters are delivered, they are quite afraid that some other people(maybe their parents) would peek. So they encrypted the letter, and only they know how to decrypt it. This guarantees their privacy. The encrypted message is an N * N matrix, and each grid contains a character. Steve uses a special mask to work as a key. The mask is N * N(where N is an even number) matrix with N*N/4 holes of size 1 * 1 on it. The decrypt process consist of the following steps: 1. Put the mask on the encrypted message matrix 2. Write down the characters you can see through the holes, from top to down, then from left to right. 3. Rotate the mask by 90 degrees clockwise. 4. Go to step 2, unless you have wrote down all the N*N characters in the message matrix. 5. Erase all the redundant white spaces in the message. For example, you got a message shown in figure 1, and you have a mask looks like figure 2. The decryption process is shown in figure 3, and finally you may get a message "good morning". You can assume that the mask is always carefully chosen that each character in the encrypted message will appear exactly once during decryption. However, in the first step of decryption, there are several ways to put the mask on the message matrix, because the mask can be rotated (but not flipped). So you may get different results such as "od morning go" (as showed in figure 4), and you may also get other messages like "orning good m", "ng good morni". Steve didn't know which direction of the mask should be chosen at the beginning, but after he tried all possibilities, he found that the message "good morning" is the only one he wanted because he couldn't recognize some words in the other messages. So he will always consider the message he can understand the correct one. Whether he can understand a message depends whether he knows all the words in the message. If there are more than one ways to decrypt the message into an understandable one, he will choose the lexicographically smallest one. The way to compare two messages is to compare the words of two messages one by one, and the first pair of different words in the two messages will determine the lexicographic order of them. Isabella sends letters to Steve almost every day. As decrypting Isabella's message takes a lot of time, and Steve can wait no longer to know the content of the message, he asked you for help. Now you are given the message he received, the mask, and the list of words he already knew, can you write a program to help him decrypt it? Input The first line contains an integer T(1 <= T <= 100), indicating the number of test cases. Each test case contains several lines. The first line contains an even integer N(2 <= N <= 50), indicating the size of the matrix. The following N lines each contains exactly N characters, reresenting the message matrix. The message only contains lowercase letters and periods('.'), where periods represent the white spaces. You can assume the matrix contains at least one letter. The followingN lines each containsN characters, representing the mask matrix. The asterisk('*') represents a hole, and period('.') otherwise. The next line contains an integer M(1 <= M <= 100), the number of words he knew. Then the following M lines each contains a string represents a word. The words only contain lowercase letters, and its length will not exceed 20. Output For each test case in the input, print one line: "Case #X: Y", where X is the test case number (starting with 1) and Y is Isabella's message. If Steve cannot understand the message, just print the Y as "FAIL TO DECRYPT". Sample Input 3 4 o.do .ng. grmn o.i. .*.. *.*. .... *... 2 good morning 4 ..lf eoyv oeou vrer ..*. .*.. .... *.*. 5 i you the love forever 4 .sle s.c. e.fs ..uu *... .*.. ...* ..*. 1 successful Sample Output Case #1: good morning Case #2: love you forever Case #3: FAIL TO DECRYPT
扑克牌游戏问题，poker card game_course
20190915Description Suppose you are given many poker cards. As you have already known, each card has points ranging from 1 to 13. Using these poker cards, you need to play a game on the cardboard in Figure 1. The game begins with a place called START. From START, you can walk to left or right to a rectangular box. Each box is labeled with an integer, which is the distance to START. Figure 1: The poker card game cardboard. To place poker cards on these boxes, you must follow the rules below: (1) If you put a card with n points on a box labeled i , you got (n ∗ i) points. (2) Once you place a card on a box b, you block the paths to the boxes behind b. For example, in Figure 2, a player places a queen on the right box of distance 1, he gets 1 ∗ 12 points but the queen also blocks the paths to boxes behind it; i.e., it is not allowed to put cards on boxes behind it anymore. Figure 2: Placing a queen. Your goal: Given a number of poker cards, find a way to place them so that you will get the minimum points. For example, suppose you have 3 cards 5, 10, and K. To get the minimum points, you can place cards like Figure 3, where the total points are 1 * 13 + 2 * 5 + 2 * 10 = 43. Figure 3: An example to place cards. Input The first line of the input file contains an integer n, n <= 10, which represents the number of test cases. In each test case, it begins with an integer m, m <= 100000, which represents the number of poker cards. Next, each card represented by its number are listed consecutively. Note that, the numbers of ace, 2, 3, ..., K are given by integers 1, 2, 3, ..., 13, respectively. The final minimum point in each test case is less than 5000000. Output List the minimum points of each test case line by line. Sample Input 3 3 5 10 13 4 3 4 5 5 5 7 7 10 11 13 Sample Output 43 34 110
BWT问题的求解的一个过程问题_course
20190825Problem Description When the problem to match S string in T string is mentioned, people always put KMP, AhoCorasick and Suffixarray forward. But Mr Liu tells Canoe that there is an algorithm called Burrows–Wheeler Transform(BWT) which is quite amazing and highefficiency to solve the problem. But how does BWT work to solve the matching SinT problem? Mr Liu tells Canoe the firstly three steps of it. Firstly, we append the ‘$’ to the end of T and for convenience, we still call the new string T. And then for every suffix of T string which starts from i, we append the prefix of T string which ends at (i – 1) to its end. Secondly, we sort these new strings by the dictionary order. And we call the matrix formed by these sorted strings Burrows Wheeler Matrix. Thirdly, we pick characters of the last column to get a new string. And we call the string of the last column BWT(T). You can get more information from the example below. Then Mr Liu tells Canoe that we only need to save the BWT(T) to solve the matching problem. But how and can it? Mr Liu smiles and says yes. We can find whether S strings like “aac” are substring of T string like “acaacg” or not only knowing the BWT(T)! What an amazing algorithm BWT is! But Canoe is puzzled by the tricky method of matching S strings in T string. Would you please help Canoe to find the method of it? Given BWT(T) and S string, can you help Canoe to figure out whether S string is a substring of string T or not? Input There are multiple test cases. First Line: the BWT(T) string (1 <= length(BWT(T)) <= 100086). Second Line: an integer n ( 1 <=n <= 10086) which is the number of S strings. Then n lines comes. There is a S string (n * length(S) will less than 2000000, and all characters of S are lowercase ) in every line. Output For every S, if S string is substring of T string, then put out “YES” in a line. If S string is not a substring of T string, then put out “NO” in a line. Sample Input gc$aaac 2 aac gc Sample Output YES NO
Alfredo's Pizza Restaurant 关于餐厅的问题_course
20200918Problem Description Traditionally after the Local Contest, judges and contestants go to their favourite restaurant, Alfredos Pizza Restaurant. The contestants are really hungry after trying hard for five hours. To get their pizza as quickly as possible, they just decided to order one big pizza for all instead of several small ones. They wonder whether it is possible to put the big rectangular pizza on the surface of the round table such that it does not overhang the border of the table. Write a program that helps them! Input The input file contains several test cases. Each test case starts with an integer number r, the radius of the surface of the round table the contestants are sitting at. Input is terminated by r=0. Otherwise, 1 ≤ r ≤ 1000. Then follow 2 integer numbers w and l specifying the width and the length of the pizza, 1 ≤ w ≤ l ≤ 1000. Output Output for each test case whether the ordered pizza will fit on the table or not. Adhere to the format shown in the sample output. A pizza which just touches the border of the table without intersecting it is considered fitting on the table, see example 3 for clarification. Sample Input 38 40 60 35 20 70 50 60 80 0 Sample Output Pizza 1 fits on the table. Pizza 2 does not fit on the table. Pizza 3 fits on the table.
A very hard Aoshu problem的程序求算问题_course
20190828Problem Description Aoshu is very popular among primary school students. It is mathematics, but much harder than ordinary mathematics for primary school students. Teacher Liu is an Aoshu teacher. He just comes out with a problem to test his students: Given a serial of digits, you must put a '=' and none or some '+' between these digits and make an equation. Please find out how many equations you can get. For example, if the digits serial is "1212", you can get 2 equations, they are "12=12" and "1+2=1+2". Please note that the digits only include 1 to 9, and every '+' must have a digit on its left side and right side. For example, "+12=12", and "1++1=2" are illegal. Please note that "1+11=12" and "11+1=12" are different equations. Input There are several test cases. Each test case is a digit serial in a line. The length of a serial is at least 2 and no more than 15. The input ends with a line of "END". Output For each test case , output a integer in a line, indicating the number of equations you can get. Sample Input 1212 12345666 1235 END Sample Output 2 2 0
 3.64MB
Xshell6完美破解版，亲测可用
20181226Xshell6破解版，亲测可用，分享给大家。直接解压即可使用
MySQL数据库从入门到实战课
20191231限时福利1：购课进答疑群专享柳峰（刘运强）老师答疑服务。 为什么说每一个程序员都应该学习MySQL？ 根据《20192020年中国开发者调查报告》显示，超83%的开发者都在使用MySQL数据库。 使用量大同时，掌握MySQL早已是运维、DBA的必备技能，甚至部分IT开发岗位也要求对数据库使用和原理有深入的了解和掌握。 学习编程，你可能会犹豫选择 C++ 还是 Java；入门数据科学，你可能会纠结于选择 Python 还是 R；但无论如何， MySQL 都是 IT 从业人员不可或缺的技能！ 【课程设计】 在本课程中，刘运强老师会结合自己十多年来对MySQL的心得体会，通过课程给你分享一条高效的MySQL入门捷径，让学员少走弯路，彻底搞懂MySQL。 本课程包含3大模块： 一、基础篇： 主要以最新的MySQL8.0安装为例帮助学员解决安装与配置MySQL的问题，并对MySQL8.0的新特性做一定介绍，为后续的课程展开做好环境部署。 二、SQL语言篇： 本篇主要讲解SQL语言的四大部分数据查询语言DQL，数据操纵语言DML，数据定义语言DDL，数据控制语言DCL，学会熟练对库表进行增删改查等必备技能。 三、MySQL进阶篇： 本篇可以帮助学员更加高效的管理线上的MySQL数据库；具备MySQL的日常运维能力，语句调优、备份恢复等思路。
 学院 Vue.js快速入门
 学院 saprk大数据分析与实战zookeeper
 博客 2020蓝桥杯省赛B组第二轮 H 字串分值
 下载 数组方法解决JS字符串连接性能问题有争议
 下载 redisdesktopmanager2020.5 最新安装版本
 下载 rfc1903.pdf
 学院 Cocos Creator 飞机大战微信小游戏开发
 下载 javascript获取当前日期时间及其它操作函数
 学院 Unity基础入门
 下载 PHP日期处理函数 整型日期格式
 博客 mac os电脑安装tomact环境及配置
 博客 sqoop export导出数据到mysql
 博客 Flume1.7.0下载及安装部署
 博客 WinIO：一个底层的键盘事件模拟工具
 下载 PHPMAILER实现PHP发邮件
 学院 FFmpeg4.3黄金系列课程：c++版
 学院 系统学习Linux命令
 学院 大数据分析闯关训练营 04期直播回放
 下载 IE6中使用position导致页面变形的解决方案(js代码)
 博客 java学习前端使用JavaScript和jQuery实现图片轮播图
 博客 自动控制原理(考研)理论篇第五章(线性系统的频域分析法)
 下载 最佳JS代码编写的14条技巧
 博客 CANoe CV2X Demo（V2I+V2V）演示视频
 下载 rfc1904.pdf
 博客 使用Canvas绘制简单工程符号（续）
 博客 8.7 一个模块的封装过程
 下载 asp中获取当前页面的地址与参数的函数代码
 博客 javax.net.ssl.SSLException: closing inbound before receiving peer‘s close_notify的解决办法
 下载 php数据库密码的找回的步骤
 学院 在金融行业中如何使用Python加速建模运算