| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 10994 | Matrix class test |
|
| 11398 | Pig-Latin (string practice) |
|
Description
Create a class Matrix to represent an N x N matrix.

Provide public member functions that perform or derive:
- Interchanging two rows.
- Rotating Matrix by 90° clockwise.
- Rotating Matrix by 90° counter clockwise.
- Checking if Matrix is symmetric or not. If yes, print “yes”, otherwise, print “no”.
Hint:
- Symmetric
A matrix A = (aij) is symmetric if its entries are symmetric with respect to the main diagonal, that is, aij = aji, for all indices i and j.
The following 3 x 3 matrix is symmetric:
1 7 3
7 4 -5
3 -5 6
Note:
1. This problem involves three files.
- function.h: Class definition of Matrix.
- function.cpp: Member-function definitions of Matrix.
- main.cpp: A driver program to test your class implementation.
You will be provided with function.h and main.cpp, and asked to implement function.cpp.
function.h
main.cpp
2. For OJ submission:
Step 1. Include function.h into function.cpp and then implement your function.cpp. (You don’t need to modify function.h and main.cpp)
Step 2. Submit the code of function.cpp into submission block.
Step 3. Check the results and debug your program if necessary.
Input
The first line has an integer N (2<=N<=50), which means the size of the matrix. The total number of elements in the matrix is thus N x N.
For the next N lines, each contains N integers, specifying the elements of the matrix.
The last line has two integers, which mean two row indices for performing row exchange.
All of the integers in the same line are separated by a space.
Output
Your program should print the corresponding results, and each is followed by a new line character.
Sample Input Download
Sample Output Download
Partial Judge Code
10994.cppPartial Judge Header
10994.hTags
Discuss
Description
You have decided that PGP encryptation is not strong enough for your email. You have decided to supplement it by first converting your clear text letter into Pig Latin before encrypting it with PGP.
You are to write a program that will take in an arbitrary number of lines of text and output it in Pig Latin. Each line of text will contain one or more words. A “word” is defined as a consecutive sequence of letters (upper and/or lower case). Words should be converted to Pig Latin according to the following rules (non-words should be output exactly as they appear in the input):
1. Words that begin with a vowel (a, e, i, o, or u, and the capital versions of these) should just have the string “ay” (not including the quotes) appended to it. For example, “apple” becomes “appleay”.
2. Words that begin with a consonant (any letter than is not A, a, E, e, I, i, O, o, U or u) should have the first consonant removed and appended to the end of the word, and then appending “ay” as well. For example, “hello” becomes “ellohay”.
3. Do not change the case of any letter.
4. The above rules are gived from origin problem in uva, and we add a addition rule: we will give you strings s1 and s2, please replace s1 with s2 in the beginning.
c++ string document: http://en.cppreference.com/w/cpp/string/basic_string
Input
The first and second lines are s1 and s2.
And then the input will be an arbitrary number of lines of text.Each line of text will contain one or more words.
Output
You are asked to replace s1 with s2 in the beginning and output it in Pig Latin (follow the rules 1, 2, and 3).
Each output line has newline in the end.