# | Problem | Pass Rate (passed user / total user) |
---|---|---|
10777 | Exam Seat Arrangement |
|
10781 | Two dimensional array rotation (counterclockwise) |
|
10784 | The number of occurrences |
|
Description
Students are asked to take seats arranged by TAs in an exam. The seats in the classroom are in M rows and N columns. Each seat assignment has three numbers: row ID, column ID, and student ID. Based on those information, print the final seat assignment in the classroom.
For example, suppose the classroom has seats in 4 rows by 2 columns, and three students attend the exam, whose IDs are 104062997, 104062998, and 104062999. The input will be like
4 2 3
1 2 104062999
3 1 104062997
4 2 104062998
The first two number means there are 4 rows by 2 columns seats in the classroom, and there are 3 students in the exam. Student 104062999 is sited in the row 1 and column 2; student 104062997 is sited in the row 3 and column 1; and student 104062998 is sited in the row 4 and column 2. The seat arrangement is given below
Your output should be
0 104062999
0 0
104062997 0
0 104062998
If a seat is not assigned to any student, your output should print 0. Since the student ID has 9 digits, each number in the output takes 9 digits space.
Input
The first line of the input has three numbers: rows of the classroom M, columns of the classroom N and the number of attendees K. Each of the following K lines contains three integers: row number, column number, and student ID. Row number starts from 1 to M, column number starts from 1 to N. 0 < M, N < 40.
Output
M rows, each row has N numbers. Each number takes 9-digit space, neighboring numbers are separated by a space. And there is a ‘\n’ at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given an NxN two-dimensional array M, you are asked to rotate M counterclockwise by 45 degrees and print out the content of M.
Consider the following 2D array:
After being rotated 45 degrees counterclockwise, it will become:
In this case, you should print:
3
2 6
1 5 9
4 8
7
Input
The first line has N (2<=N<=100), which means the size of the 2D array. The total number of elements in the 2D array is thus N x N.
For the next N lines, each contains N integers, specifying the elements of the 2D array. All of the integers in the same line are separated by a space.
Output
Print out all elements of the rotated 2D array row-by-row.
All of the integers in the same line are separated by a space, and there is a '\n' at the end of each line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Given a string A and a string B, count the number of occurrences of string A in B . All of the strings contain only characters.
For example, if A is “ab” and B is "abflskuab"
then your answer should be 2 because A appears in “abflskuab” two times.
Note that if A is “aa” and B is “aaaa”, the number of occurrences of A in B is counted as 3.
You may assume string B is always longer than string A.
Input
The first line of the input is the string A (length of A = 2). The second line is the string B(2 <= length of B <= 9).
Output
The number of occurrences of A appears in B. Note that you DO NOT need to print ‘\n’ at the end of the output.