Question one hundred and fifty-one: haelection actress

Source: Internet
Author: User

PS: You can submit program 1 with G ++, but you cannot submit program 2 with GCC. The difference between program 1 and Program 2 is to change the absolute value function fabs () to abs (). (If the gods know, explain the reasons. Thank you !)

 


Procedure 1:


[Plain] # include <stdio. h>
# Include <math. h>
 
Int main ()
{
Int I;
Int j;
Int n;
Int m;
Int x;
Int y;
Int max;
Int num [101] [101];
 
While (scanf ("% d", & n, & m )! = EOF)
{
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
Scanf ("% d", & num [I] [j]);
}
}

X = y = 0;
Max = 0;
 
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
If (fabs (num [I] [j])> fabs (max) // use fabs ()
{
Max = num [I] [j];
X = I;
Y = j;
}
}
}
 
Printf ("% d \ n", x + 1, y + 1, max );
}
 
Return 0;
}

# Include <stdio. h>
# Include <math. h>

Int main ()
{
Int I;
Int j;
Int n;
Int m;
Int x;
Int y;
Int max;
Int num [101] [101];

While (scanf ("% d", & n, & m )! = EOF)
{
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
Scanf ("% d", & num [I] [j]);
}
}

X = y = 0;
Max = 0;

For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
If (fabs (num [I] [j])> fabs (max) // use fabs ()
{
Max = num [I] [j];
X = I;
Y = j;
}
}
}

Printf ("% d \ n", x + 1, y + 1, max );
}

Return 0;
}

Procedure 2:


[Plain] # include <stdio. h>
# Include <math. h>
 
Int main ()
{
Int I;
Int j;
Int n;
Int m;
Int x;
Int y;
Int max;
Int num [101] [101];
 
While (scanf ("% d", & n, & m )! = EOF)
{
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
Scanf ("% d", & num [I] [j]);
}
}

X = y = 0;
Max = 0;
 
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
If (abs (num [I] [j])> abs (max) // abs () is used ()
{
Max = num [I] [j];
X = I;
Y = j;
}
}
}
 
Printf ("% d \ n", x + 1, y + 1, max );
}
 
Return 0;
}

# Include <stdio. h>
# Include <math. h>

Int main ()
{
Int I;
Int j;
Int n;
Int m;
Int x;
Int y;
Int max;
Int num [101] [101];

While (scanf ("% d", & n, & m )! = EOF)
{
For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
Scanf ("% d", & num [I] [j]);
}
}

X = y = 0;
Max = 0;

For (I = 0; I <n; I ++)
{
For (j = 0; j <m; j ++)
{
If (abs (num [I] [j])> abs (max) // abs () is used ()
{
Max = num [I] [j];
X = I;
Y = j;
}
}
}

Printf ("% d \ n", x + 1, y + 1, max );
}

Return 0;
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.