Triángulo de Reuleaux más grande dentro de un cuadrado que está inscrito dentro de un círculo

Aquí se da un círculo de radio r , 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: r = 6
Output: 50.7434

Input: r = 11
Output: 170.554

Enfoque : De la figura, es muy claro que, si el lado del cuadrado es a , entonces 
 

a√2 = 2r  
a = √2r

Además, en el triángulo de Reuleaux, h = a = √2r , consulte el triángulo de Reuleaux más grande dentro de un cuadrado
Entonces, el área del triángulo de Reuleaux es A = 0.70477*h^2 = 0.70477*2*r^2 
 

C++

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

Java

// Java Program to find the biggest Reuleaux
// triangle inscribed within in a square which
// in turn is inscribed within a circle
import java.util.*;
 
class GFG
{
 
// Function to find the Area
// of the Reuleaux triangle
static double ReuleauxArea(double r)
{
 
    // radius cannot be negative
    if (r < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    double A = 0.70477 * 2 * Math.pow(r, 2);
 
    return A;
}
 
// Driver code
public static void main(String args[])
{
    double r = 6;
    System.out.println(ReuleauxArea(r));
     
}
}
// This code is contributed by
// Surendra_Gangwar

Python3

# Python3 Program to find the biggest
# Reuleaux triangle inscribed within
# in a square which in turn is inscribed
# within a circle
import math as mt
 
# Function to find the Area
# of the Reuleaux triangle
def ReuleauxArea(r):
 
    # radius cannot be negative
    if (r < 0):
        return -1
 
    # Area of the Reuleaux triangle
    A = 0.70477 * 2 * pow(r, 2)
 
    return A
 
# Driver code
r = 6
print(ReuleauxArea(r))
 
# 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 a circle
using System;
 
class GFG
{
 
// Function to find the Area
// of the Reuleaux triangle
static double ReuleauxArea(double r)
{
 
    // radius cannot be negative
    if (r < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    double A = 0.70477 * 2 * Math.Pow(r, 2);
 
    return A;
}
 
// Driver code
public static void Main()
{
    double r = 6;
    Console.WriteLine(ReuleauxArea(r));
}
}
 
// This code is contributed by
// shs..

PHP

<?php
// PHP Program to find the biggest Reuleaux
// triangle inscribed within in a square
// which in turn is inscribed within a circle
 
// Function to find the Area of the
// Reuleaux triangle
function ReuleauxArea($r)
{
 
    // radius cannot be negative
    if ($r < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    $A = 0.70477 * 2 * pow($r, 2);
 
    return $A;
}
 
// Driver code
$r = 6;
echo ReuleauxArea($r) . "\n";
 
// This code is contributed by ita_c
?>

Javascript

<script>
// javascript Program to find the biggest Reuleaux
// triangle inscribed within in a square which
// in turn is inscribed within a circle
 
// Function to find the Area
// of the Reuleaux triangle
function ReuleauxArea(r)
{
 
    // radius cannot be negative
    if (r < 0)
        return -1;
 
    // Area of the Reuleaux triangle
    var A = 0.70477 * 2 * Math.pow(r, 2);
 
    return A;
}
 
// Driver code
 
var r = 6;
document.write(ReuleauxArea(r));
 
 
// This code contributed by Princi Singh
</script>
Producción: 

50.7434

 

Complejidad de tiempo: O(1)

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 *