can any one help me
Code: Select all
#include <iostream>
#include <cmath>
using namespace std;
int n, m;
double d[105], a, b, c, s, k;
#define EPS -(1e-9)
int main()
{
cin >> m;
for (int i = 0; i < m; i++)
cin >> d[i];
cin >> n;
for (int j = 0; j < n; j++)
{
cin >> a >> b >> c;
k = (a + b + c) / 2;
s = sqrt(k * (k - a) * (k - b) * (k - c));
k = (a * b * c) / 2 / s;
bool g = 0;
for (int i = 0; i < m; i++)
if (d[i] - k > EPS)
if (g)
cout << " " << i+1;
else
cout << "Peg " << char(j + 'A') << " will fit into hole(s): " << i + 1, g = true;
if (!g)
cout << "Peg " << char(j + 'A') << " will not fit into any holes";
cout << endl;
}
}
thanks in advance[/code]