Http://acm.zju.edu.cn/onlinejudge/showProblem.do? Problemcode = 1004.
Tracing is mainly used. In recursion, all characters are first put into the stack. During backtracking, the system checks whether the characters exit the stack and record the path. Stacks are simulated using character arrays.
In addition, the output of this question is a bit confusing. There is a space behind the last I or O in each line, and it does not need to be processed.
Code:#
Question
Returns n strings and the one with the most occurrences.
Analysis
Save the string and sort it.
Accepted code
1 /* 2 PROBLEM:hdu1004 3 AUTHER:Nicole Lam 4 MEMO:水题 5 */ 6 7 #include
Question/HDU 1004 let the balloon rise
Question 1004: MedianDescription:
Given an increasing sequence S of N integers, the median is the number at the middle position. for example, the median of S1 = {11, 12, 13, 14} is 12, and the median of S2 = {9, 10, 15, 16, 17} is 15. the median of two sequences is defined to be the median of the non-decreasing sequence which contains all the elements of both sequences. for example, the median of S1 and S2 is 13.Given two increasing sequences of inte
1004. Score ranking (20) Time Limit 400 MS
The memory limit is 32000 kb.
Code length limit: 8000 B
Criterion author Chen, Yue
The name, student ID, and score of N students are read, and the names and student IDs of the students with the highest and lowest scores are output respectively.
Input Format:Each test input contains one test case in the format
Row 1st: positive integer n row 2nd: 1st Student name score row 3rd: 2nd Student name score ........
Problem DescriptionThis day the teacher again to small Hao out a topic: give you three lengths, respectively, A,b,c match, let you calculate the three matches can make up of the Triangle area.InputEnter each row to include three number a,b,c.OutputThe area of the output triangle for each row (reserved three decimal places), cannot be composed of triangles told the small Hao output "no!".Sample Input1 2 33) 4 5Sample Outputno!6.000HINT1#include 2#include 3 intMain ()4 {5 Doubles,a,b,c,p;6
Problem DescriptionEnter an unsigned short integer k[hex.] and P[oct.], the high byte of K as the low byte of the result, and the high byte of p as the result of the high byte to form a new integer.InputK[hex.] and P[oct.]OutputThe operation gets the new integer n.Sample Input0XD9 01117Sample Output200HINTOutput is 16 binary1#include 2 intMain ()3 {4 5 intk,p;6 while(SCANF ("%x%o", k,p)! =EOF)7 {8 intNewint = (p0xff00)| (k0xff00) >>8;9printf"%x\n", newint);Ten }
case input: Each case the first line is n, contains n data, that is, the color of n strings read into, calculate the most occurrences of the color and output!The topic is very simple! I've built a string array here in Java string[] Strarray = new String[n]; To save each color, Use an integer a array to hold the number of occurrences of each color. (The subscript of the array of arrays corresponds to the subscript of the string array Strarray) finally calculates the maximum number of occurrences
Test instructions: Gives the n color, statistics the most occurrence color.Algorithm: Sorts the strings first, then iterates over the colors that appear the most frequently.Code:#include Hdoj 1004 String Sort
1004 Count
Discription
You is given an integer array s[] and is asked to count how many positions a, B, C and D satisfy the condition:s[a] + s [b] + s[c] = = S[d].Note that A, B, C, and D does not need to be distinct.
Input
The first line of input contains an integer T, indicates the cases.Each of the next T blocks contains a integer n first (0
Output
Output T Lines Each contains the answer required. You ' d better use ' long long ' instead of ' in
Sdust training session
At that time, I had no idea how to deal with this problem for three hours.
Convert to an undirected graph according to the meaning of the question, pre-process and remove one-way edge, and then determine whether the remaining graph can constitute two undirected full graphs (PS a full graph can also be a complete graph or a full graph + an orphan)
The Code was a great online player after the game, so I reprinted it. The DFS dyeing was very clever and clever. When I used it,
Read n (>) students ' names, school numbers, and grades, respectively, and the names and student numbers of the students with the highest and lowest grades. Input Format:Each test input contains 1 test cases in the form第 1 行:正整数 n第 2 行:第 1 个学生的姓名 学号 成绩第 3 行:第 2 个学生的姓名 学号 成绩 ... ... ...第 n+1 行:第 n 个学生的姓名 学号 成绩where 姓名 and 学号 both are not more than 10 characters of the string, the score is an integer between 0 and 100, which guarantees that no two students in a set of test cases have the sam
Time limit MS Memory limit 65536 KB code length limit 8000 B procedure StandardAuthor Chen, YueRead the names, student numbers and grades of n students, respectively, and output the highest and lowest grade students ' names and school numbers.input Format: each test input contains 1 test cases in the format Line 1th: Positive integer n 2nd line: 1th Student's name School number results 3rd line: 2nd Student's name study number score ... Line n+1: Nth Student's name number scoreWhere both the
Link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 1004
Water question, used to train the trainer.
Inputinput contains multiple test cases. each test case starts with a number N (0 Letters.
A test case with n = 0 terminates the input and this test case is not to be processed.
Outputfor each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.
Sample Inp
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.