Topic Connection: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1333Test instructions: give you an n vertex, M edge (each edge has three parameters, opening time, closing time, and the time of passing this edge) of the direction graph;You need to find the shortest path from S to T; Dijkstra algorithm can be solved;Pit point: I use the queue optimization +vector store each edge, after each call Dijkstra, must initialize the adjacency table, in this place for a long time, this is the second, af
Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1409Descriptiongive two sets consisting of integersA,B, calculateA∪Bcontains the number of integers. Inputthe first line of input contains an integerT(T> 0), indicating that there are altogetherTGroup test Data. for each set of test data, the first row contains an integerN(1≤N≤Ten5). The second line contains 2Nan integera1,b1,a2,b2,...,aN,bN(0 a1≤b1a2≤b2aN≤bN9), indicatingA=[a1,b1]∪[a2,b2]∪...∪[aN,bN]. The third line contains an intege
title Link:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1408Descriptionas shown, we planted a straight road in front of the door.Ntrees. However, recently we have found that if the distance between two saplings is less than a constantD, the development of the two saplings will be hindered. So we decided to remove some saplings so that the distance between any two saplings is not less thanD, and the more saplings we wish to leave, the better. Inputthe first line of input contains an integerT(
Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1505DescriptionEnter some words that consist only of lowercase letters. Your task is to count how many words are "cool", that is, each letter appears in a different number of times.Ada is cool, for example, because a appears 2 times, D appears 1 times, and 1 and 2 are different. For example, banana is also cool, because a appears 3 times, N appears 2 times, B appears 1 times. However, BBACCCD is not cool because A and d appear the same
Title Link: http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1511DescriptionInputThe input contains no more than 10000 sets of data. Each set of data contains 6 integers r1, C1, R2, C2, R3, C3 (1OutputFor each set of data, the test point number and the minimum number of steps are output.Sample Input1 1 8 7 5 61 1 3 3 2 2Sample OutputCase 1:7case 2:3HINTSourceThe tenth session of Hunan Province College students computer Program design ContestThe code is as follows:#include
Prime slotDescription In the adjacent two primes p p + n the n- 1 n 24, +, +,- is in prime number 23 29 A length of 6 Your task is to write a program to calculate The length of the prime slot that contains the integer k. If K itself is a prime number, it is assumed that the length of the prime slot containing K is 0. InputThe first line is a number N that represents the number of data that needs to be tested. Followed by n rows, each line being a positive integer k,k
Test Instructions:There are three families with a garden, and the wives of each family are required to help arrange the garden. Mrs. A worked for 5 days, and Mrs. B worked for 4 days before finishing the garden. Mrs. C was 90 yuan because she was pregnant unable to join them. How is this money assigned to a and B two wives more appropriate? How many dollars does A deserve? 90/(5+4) *5=$50 yuan? If you think so, you'll be fooled! The correct answer is 60 yuan. If you don't get it, think again. He
1333:funny Car Racing Time
limit: 1 Sec
Memory Limit: MB
Submit: 482
Solved: 116
[Submit] [Status] [Web Board]
DescriptionThere is a funny car racing in a city with N junctions and m directed roads.The funny part Is:each Road is open and closed periodically. Each road was associate with a integers (a, b), that means the road would be an open for a seconds , then closed for b seconds and then open for a seconds ... All these start from the beginning of the race. You mus
Topic Link: Click to open the linkGiven n individuals, the vehicle's manned capacity mThe A[i] array is given belowIf you want to invite me to the car, you must first invite A[i]Q: How many people can I invite?It is observed that this is a forward graph, and the resulting graph is similar to the tree, but the tail of the chain is a simple ring, according to I->a[i.As follows:5 22 3 4 1 4We must first invite 1234 at the same time to invite 5.So create a reverse graph (that is, the opposite side),
DescriptionSunnypig is a pig who is much cleverer than any other pigs in the pigpen. One sunny morning, Sunnypig wants to go out of the pigpen to date Mrs Snail, he beloved. However, it's terribly tough for a pig to go out of the the Pigpen because the pigpen are divided into M * N grids with fences Which pigs cannot go across. Luckily, there is some doors unlocked on the fences so this sunnypig can push them open with his nose. Since Sunnypig was a pig, no matter how clever he was, he can never
1611:concatenation time
limit: 1 Sec
Memory Limit: MB
Submit:
Solved: 4
[Submit] [Status] [Web Board]
DescriptionZuosige always have bad luck. Recently, he is in hospital because of pneumonia. While he was taking his injection, he feels extremely bored. However, clever zuosige comes up with a new game.Zuosige writes some of he favorite strings on paper. And he wants to the find out a string which have all these favorite strings as its substrings. However, as a sick ma
Topic Link: Click to open the linkDescriptionGive a positive number, count the sum of the distinct subsequence of it, moreover, any subsequence should not contain leads ing zeroes except it is zero.For example, if the number was 1022, the answer is 1 + 0 + 2 + 10 + 12 + 22 + 102 + 122 + 1022 = 1293.InputThe first line had an integer T, means there is T test Cases.For each test case, there was only one line with a positive number, the number of the digits of it are in range [1, 105].The size of t
Topic Link: Click to open the linkTest instructionsGiven a long integerAll different sub-sequences and.Ideas:Dp[i] denotes the and of the sequence ending with the i numberNum[i] Indicates the number of sequences ending with an I numberImport Java.io.printwriter;import java.util.arraylist;import Java.util.arrays;import Java.util.Collections;import Java.util.comparator;import Java.util.iterator;import Java.util.linkedlist;import Java.util.PriorityQueue;import Java.util.scanner;import Java.util.tre
Test instructions: There is a row of n buildings each high uncertainty now to eliminate all buildingsThere are two ways to eliminate all blocks with a value of 1.2 elimination of an entire buildingAsk how to eliminate it with minimal stepsIdea: First sort the array from large to small if (I+a[i]#include CSU 1578 Opening ceremony (recursive)
1663:tree time
limit: 5 Sec
Memory Limit: MB
Submit:
Solved: 11
[Submit] [Status] [Web Board]
DescriptionCSU has a lot of trees. But there was a tree which is different from the others. This one was made of weighted edges and I had three kinds of operations on it:1. C a B:change the weight of edge A to B (1≤b≤100);2. M a B c:multiply the weights of those edges on the path from Node A to Node B by C (|c|≤10, c≠0);3. Q a b:get the sum of weights from all the edges on th
Topic Link: PortalTest instructionsThere are n points, M edges, to make all n points together and to spend the least, ask which side is necessary to connect.Analysis:To minimize the cost of making sure is to make the smallest spanning tree, but the topic requires which sides are necessary to use. We canTo think like this, we first ask for the smallest spanning tree and then count the edgesLift This n-1 the edges so they can't be used, and then continue to do the minimum spanning tree if the last
AI and water level bi for the flood of the first I, and count how many bridges have been flooded at least k times. The initial water level is 1, and the swollen water level of each flood must be greater than the water level of the last flood.InputThe input file contains up to 25 sets of test data. The first behavior of each group of data is three integers n, m, K (1OutputFor each set of data, output the number of bridges that have been flooded at least k times.Sample Input2 2 22 56 28 35 3 22 3
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.