在x^(y^2)或y^(x^2)中找到最大值,其中x和y是给定的

给定值大于2的X和Y,任务是找出其中的最大值

null

x^(y^2)和y^(x^2)

考虑一下 十、 大于 Y Y 大于 十、 .所以,如果 x^(y^2) 大于或等于2,如果 y^(x^2) 更大。 例如:

Input: X = 4, Y = 9Output: 1Input: X = 4, Y = 3Output: 2

方法: 假定

*** QuickLaTeX cannot compile formula: *** Error message:Error: Nothing to show, formula is empty

,然后在两边取ln,除以

*** QuickLaTeX cannot compile formula: *** Error message:Error: Nothing to show, formula is empty

我们可以

*** QuickLaTeX cannot compile formula: *** Error message:Error: Nothing to show, formula is empty

. 拿

*** QuickLaTeX cannot compile formula: *** Error message:Error: Nothing to show, formula is empty

.这个函数对于

*** QuickLaTeX cannot compile formula: *** Error message:Error: Nothing to show, formula is empty

.

图片[1]-在x^(y^2)或y^(x^2)中找到最大值,其中x和y是给定的-yiteyi-C++库

If x > y, then F(x) < F(y)

C++

// C++ program to find the greater value
#include <bits/stdc++.h>
using namespace std;
// Function to find maximum
bool findGreater( int x, int y)
{
// Case 1
if (x > y) {
return false ;
}
// Case 2
else {
return true ;
}
}
// Driver Code
int main()
{
int x = 4;
int y = 9;
findGreater(x, y) ? cout << "1"
: cout << "2" ;
return 0;
}


JAVA

// Java program to find
// the greater value
import java.io.*;
class GFG
{
// Function to find maximum
static boolean findGreater( int x,
int y)
{
// Case 1
if (x > y)
{
return false ;
}
// Case 2
else
{
return true ;
}
}
// Driver Code
public static void main (String[] args)
{
int x = 4 ;
int y = 9 ;
if (findGreater(x, y))
System.out.println( "1" );
else
System.out.println( "2" );
}
}
// This code is contributed
// by inder_verma.


Python3

# Python3 program to find
# the greater value
# Function to find maximum
def findGreater(x, y):
# Case 1
if (x > y):
return False ;
# Case 2
else :
return True ;
# Driver Code
x = 4 ;
y = 9 ;
if (findGreater(x, y)):
print ( "1" );
else :
print ( "2" );
# This code is contributed
# by mits


C#

// C# program to find
// the greater value
using System;
class GFG
{
// Function to find maximum
static bool findGreater( int x,
int y)
{
// Case 1
if (x > y)
{
return false ;
}
// Case 2
else
{
return true ;
}
}
// Driver Code
public static void Main ()
{
int x = 4;
int y = 9;
if (findGreater(x, y))
Console.WriteLine( "1" );
else
Console.WriteLine( "2" );
}
}
// This code is contributed
// by inder_verma.


PHP

<?php
// PHP program to find the greater value
// Function to find maximum
function findGreater( $x , $y )
{
// Case 1
if ( $x > $y )
{
return false;
}
// Case 2
else
{
return true;
}
}
// Driver Code
$x = 4;
$y = 9;
if (findGreater( $x , $y ) == true)
echo ( "1" );
else
echo ( "2" );
// This code is contributed
// by inder_verma
?>


Javascript

<script>
// JavaScript program to find
// the greater value
// Function to find maximum
function findGreater(x,y)
{
// Case 1
if (x > y)
{
return false ;
}
// Case 2
else
{
return true ;
}
}
// Driver Code
var x = 4;
var y = 9;
if (findGreater(x, y))
document.write( "1" );
else
document.write( "2" );
// This code is contributed by 29AjayKumar
</script>


输出:

1

© 版权声明
THE END
喜欢就支持一下吧
点赞10 分享