| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 11325 | Transpose of A Matrix |
|
| 11327 | Dictionary subsearch |
|
Description
Given a matrix A (you can consider it as a 2-D array), print out transpose of A.
Note: Try to use dynamic memory management to finish this problem.
main.c
#include <stdio.h>
#include "function.h"
int main(void) {
int **mat;
int m, n, i;
scanf("%d %d", &m, &n);
mat = allocateMat(m, n);
readInput(mat, m, n);
printResult(mat, m, n);
// Be sure to release acquired memory space
for(i=0; i<m; i++)
free(mat[i]);
free(mat);
return 0;
}
function.h
#ifndef FUNCTION_H #define FUNCTION_H int** allocateMat(int, int); void readInput(int**, int, int); void printResult(int**, int, int); #endif
Input
First line has two unsigned integers, indicates A is M rows by N columns. Next M lines are the content of A, each line has N integers.
Output
N lines, each line contains M integers. Values are separated by a blank. There’s a blank and a newline at the end of each line.
Sample Input Download
Sample Output Download
Partial Judge Code
11325.cPartial Judge Header
11325.hTags
Discuss
Description
Given a dictionary with n words, such as A1, A2, ..., An, and a string B for searching. If B is a substring of Ai, then Ai is one of the word that we want to search. Find out all the words we want to search.
Note that all the words in dictionary and the string B contain only uppercase or lowercase alphabets. And when searching, uppercase letters are considered the same as lowercase letters, for example, we can use 'the' to find 'THE'.
Input
The first line of the input is an integer n (0<n≦1000).
For the next n lines, each line contains a string Ai (0<length of Ai≦100) and a ‘\n’ at the end of the line.
The last line contains the string B (0<length of B≦10).
Output
Print out all the searched words in their original order in dictionary. Note that you NEED to print ‘\n’ at the end of all the words.