Mayor Triángulo de Reuleaux inscrito en un Cuadrado inscrito en un triángulo equilátero

Aquí se da un triángulo equilátero de lado a que inscribe un cuadrado que a su vez inscribe un triángulo reuleaux . La tarea es encontrar el área máxima posible de este triángulo de Reuleaux .
Ejemplos: 
 

Input : a = 5 
Output : 3.79335

Input : a = 9
Output : 12.2905

Enfoque : sabemos que el lado del cuadrado inscrito dentro de un triángulo equilátero de longitud lateral  a      es, x = 0.464*a (consulte aquí) .
Además, en el triángulo de Reuleaux, h = x .
Entonces, Área del Triángulo de Reuleaux
 

A = 0.70477*h2 
  = 0.70477*(0.464*a)2

A continuación se muestra la implementación del enfoque anterior: 

C++

// C++ Program to find the biggest Reuleaux triangle
// inscribed within in a square which in turn
// is inscribed within an equilateral triangle
#include <bits/stdc++.h>
using namespace std;
 
// Function to find the biggest reuleaux triangle
float Area(float a)
{
 
    // side cannot be negative
    if (a < 0)
        return -1;
 
    // height of the reuleaux triangle
    float x = 0.464 * a;
 
    // area of the reuleaux triangle
    float A = 0.70477 * pow(x, 2);
 
    return A;
}
 
// Driver code
int main()
{
    float a = 5;
    cout << Area(a) << endl;
 
    return 0;
}

Java

// Java Program to find the biggest Reuleaux triangle
// inscribed within in a square which in turn
// is inscribed within an equilateral triangle
 
class GFG
{
     
// Function to find the biggest reuleaux triangle
static float Area(float a)
{
 
    // side cannot be negative
    if (a < 0)
        return -1;
 
    // height of the reuleaux triangle
    float x = 0.464f * a;
 
    // area of the reuleaux triangle
    float A = 0.70477f * (float)Math.pow(x, 2);
 
    return A;
}
 
// Driver code
public static void main (String[] args)
{
    float a = 5;
    System.out.println(String.format("%.5f", Area(a)));
}
}
 
// This code is contributed by chandan_jnu

Python3

# Python3 Program to find the biggest
# Reuleaux triangle inscribed within
# in a square which in turn is inscribed
# within an equilateral triangle
import math as mt
 
# Function to find the biggest
# reuleaux triangle
def Area(a):
 
    # side cannot be negative
    if (a < 0):
        return -1
 
    # height of the reuleaux triangle
    x = 0.464 * a
 
    # area of the reuleaux triangle
    A = 0.70477 * pow(x, 2)
 
    return A
 
# Driver code
a = 5
print(Area(a))
 
# This code is contributed by
# Mohit Kumar 29

C#

// C# Program to find the biggest Reuleaux
// triangle inscribed within in a square
// which in turn is inscribed within an
// equilateral triangle
using System;
 
class GFG
{
     
// Function to find the biggest
// reuleaux triangle
static float Area(float a)
{
 
    // side cannot be negative
    if (a < 0)
        return -1;
 
    // height of the reuleaux triangle
    float x = 0.464f * a;
 
    // area of the reuleaux triangle
    float A = 0.70477f * (float)Math.Pow(x, 2);
 
    return A;
}
 
// Driver code
public static void Main ()
{
    float a = 5;
    Console.WriteLine(String.Format("{0,0:#.00000}",
                                          Area(a)));
}
}
 
// This code is contributed by Akanksha Rai

PHP

<?php
// PHP Program to find the biggest Reuleaux
// triangle inscribed within in a square
// which in turn is inscribed within an
// equilateral triangle
 
// Function to find the biggest
// reuleaux triangle
function Area($a)
{
 
    // side cannot be negative
    if ($a < 0)
        return -1;
 
    // height of the reuleaux triangle
    $x = 0.464 * $a;
 
    // area of the reuleaux triangle
    $A = 0.70477 * pow($x, 2);
 
    return $A;
}
 
// Driver code
$a = 5;
echo Area($a) . "\n";
 
// This code is contributed
// by Akanksha Rai

Javascript

<script>
 
// Javascript Program to find the biggest Reuleaux triangle
// inscribed within in a square which in turn
// is inscribed within an equilateral triangle
 
// Function to find the biggest reuleaux triangle
function Area( a)
{
 
    // side cannot be negative
    if (a < 0)
        return -1;
 
    // height of the reuleaux triangle
    let x = 0.464 * a;
 
    // area of the reuleaux triangle
    let A = 0.70477 * Math.pow(x, 2);
 
    return A;
}
 
// Driver code
 
    let a = 5;
    document.write( Area(a).toFixed(5));
 
// This code contributed by Rajput-Ji
 
</script>
Producción: 

3.79335

 

Complejidad de tiempo: O (logn)

Espacio Auxiliar: O(1)

Publicación traducida automáticamente

Artículo escrito por IshwarGupta y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *