# | Problem | Pass Rate (passed user / total user) |
---|---|---|
11146 | Find the maximum/minimum values |
|
13559 | Bingo rotation |
|
13586 | Patrick's Calculator |
|
Description
In this problem, you are asked to implement a program which can find the maximum element M and minimum element mof a two-dimensional array. You need to print the location difference and value difference of M and m. For example, if M is at iM-th row and jM-th column and of value rM, and m is at im-th row and jm-th column and of value rm, then the location difference and value difference of the two elements are (|iM - im| + |jM - jm|) and (|rM - rm|), respectively.
Note that in a given array, no two elements will have the same value.
HINT: You can use C library function: int abs(int x) ,which returns the absolute value of int x.
Before using abs(), you may need to add the following code at first : #include <stdlib.h>
Input
The first line of the input contains two integer numbers R (2<=R<=10) and C (2<=C<=10).
Each of the next R lines contains C integers, specifying the elements of the two-dimensional array. All of the integers in the same line are separated by a space.
Output
The output contains two integers: the location difference and the value difference of the maximum and minimum elements, separated by a space.
Note that you do not need to print ‘\n’ at the end of line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Gregory is planning to play bingo on Freddy's birthday! To ensure Freddy wins the game, Gregory made a special bingo card for Freddy and determined the number sequence for everyone to mark in order. However, it would be too obvious if he gives Freddy a certain bingo card, so Gregory decided to make other cards for Freddy to choose from, but also ensures Freddy would win while keeping the number sequence the same.
Here's what Gregory is going to do: Gregory had the special bingo card already, and he wants to create another bingo card by rotating the special bingo card so that the two cards seem different and both of them can win the bingo game.
Now Gregory has decided the angle he wants to rotate, please help him make the bingo card he wants.
Here are some examples for the rotated cards. The cards are rotated counterclockwise and will only be rotated by 0, 90, 180, or 270 degrees.
Input
The first line contains an integer n, which means the size of the bingo card is n * n.
The following n lines each containing n positive integers represent the special bingo card.
The last line contains an integer a (0, 90, 180, or 270), which means the angle Gregory wants to rotate.
It is guaranteed that all numbers on bingo cards are less than 103。
(3 ≤ n ≤ 100)
Output
Output contains n lines, each line has n integers, representing the rotated bingo card.
Do not print extra space at the end of the line.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Patrick Star is trying to implement a basic calculator that supports addition, subtraction, multiplication, and division in the C program. Unfortunately, Patrick can't find the bug with his program for the addition operation, and he needs your help!
The problem is quite simple, calculate the sum of the given two numbers.
To represent the decimal number more clearly, we add commas (,) to the number to group the digits. e.g. 1,234,567. The commas will be added to the input two numbers. You will also need to output the answer with commas.
Please notice that the two numbers might be too large to fit in the int data type, and you may consider storing these two numbers in the other way.
Input
The input contains two lines, each line with a single number.
The digit of these two numbers (not including commas) is no more than 100.
Output
The output contains one line with one single number, the sum of the two numbers.