2022 - audition for heroine

Although Mr. Potato likes teaching very much, but under the pressure of life, he has to find a way to earn some extra money in his spare time to support his family.
"What should I do to make money? I don't have the strength to sift sand, and I'm not handsome enough to see the door..." Teacher Potato was very helpless.
"Zhang Yimou is even uglier than you, how rich he is now, and I heard that he has to direct the opening ceremony of the Olympic Games! Why don't you go to the entertainment industry to develop?" lwg gave an idea.
Well, also, in order to survive, let's go to the entertainment circle and make a laser film "Hangdian Memory - Come Back My Love".
Just do what you say, choose the heroine in Shanghai (learned from Laomouzi, this move can attract the attention of the media, huh), and specially stipulates that the actor must have the basic skills of ac, otherwise he will be directly out!
Due to the planner Feng Zhiyu (Master Water King) The publicity was in place, and many MMs came to apply for the job, of course, including nit's cake sister and other high-profile beauties, even Zjut's jqw disguised as a woman to apply for the job (fortunately, it was recognized by the security consultant hdu_Bin-Laden It seems that the entertainment industry is more attractive than acm...
On the day of the interview, m*n MM happened to come, standing in a queue of m*n, and the assistant director Fe(OH)2 was for each MM The scores are all 32-bit signed integers.
At first I wondered: how come the scores are still negative? Fe(OH)2 explained that according to the selection rules, points will be deducted if the hair is dyed yellow, the makeup is too heavy, the clothing is too little, etc., and if the deduction is too much, it may be a negative point. Of course, if you find words If there is Japanese in the middle, I will give -2147483648 points directly.
The scores are sent, it is time for me to make a decision. One of my selection principles is to choose an MM with the largest absolute value of the interview score (it must still be a 32-digit integer).
Special note: If you are unfortunate enough to choose a MM with a negative score, it doesn't matter, because I think that if you can't attract you, you will be disgusting.
Input
There are multiple groups of input data. The first row of each group is two integers m and n, which represent the total number of rows and columns for MM candidates, followed by m rows of integers, each row has n, the definition of m and n is shown in the description of the title .
Output
For each set of input data, output three integers x, y and s, which represent the row number, column number and score of the selected MM, respectively.
Note: The row number and column number start from the beginning. If there are multiple MM scores with the same absolute value, then the output is the first one (that is, the one with the smallest row number, if the row number is the same, the one with the smallest column number is taken).
Sample Input
2 3
1 4 -3
-7 3 0
Sample Output
2 1 -7
Note: It looks very long. To sum up, find the number with the largest absolute value in the MxN matrix and return this number and its row and column number. At the beginning, it was written as >a[1][1] in the judgment of line 15, and the result was that the error was not found here, and it was stuck for a long time. It also told me that my thinking must be clear at all times, not to be sloppy at any time, and to know the function and meaning of each step of my own.

#include<stdio.h>
#include<math.h>
int main()
{
    int a[100][100];
    int i, j, p, q, m, n;
    while (~scanf("%d%d", &m, &n) && m!=0){
        for (i=1; i<=m; i++)
         for (j=1; j<=n; j++){
            scanf("%d", &a[i][j]);//给数组赋值
         }
        p = 1;q = 1;//p,q初始化
        for (i=1; i<=m; i++)
         for (j=1; j<=n; j++){
            if (fabs(a[i][j])>fabs(a[p][q])){//判定
                p = i;
                q = j;
            }
         }
        printf("%d %d %d\n", p, q, a[p][q]);
    }
    return 0;
}

Below is the simplified code. I think it can be judged while inputting, but the oj system has been wrong answer, the answer of the compiler is correct, so if I am lucky enough to be seen by the big guy, please point out the problem.

#include<stdio.h>
#include<math.h>
int main()
{
    int a[100][100];
    int i, j, p=1, q=1, m, n;
    while (~scanf("%d%d", &m, &n) && m!=0){
        for (i=1; i<=m; i++)
        for (j=1; j<=n; j++){
            scanf("%d", &a[i][j]);
            if (fabs(a[i][j])>fabs(a[p][q])){
                p = i;
                q = j;
            }
         }
        printf("%d %d %d\n", p, q, a[p][q]);
    }
    return 0;
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324691815&siteId=291194637