This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
//#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
std::vector<double> v;
struct comp_object {
bool operator() (int a, int b) {
return (a > b);
};
} comp_obj;
void devide(double a, double b, int N){
if ( --N < 0 )
return;
//삼각형 쪼개서 넓이 구하기
//빗변
double e = sqrt(pow(a,2)+pow(b,2));
double h = a*b/e;
//1번 삼각형
double a2 = sqrt(pow(a,2)-pow(h,2));
double A = a2*h*0.5;
//printf("A = %f\n",log(A));
v.push_back(log(A));
devide(a2,h,N);
//2번 삼각형
double b2 = sqrt(pow(b,2)-pow(h,2));
double B = b2*h*0.5;
//printf("B = %f\n",log(B));
v.push_back(log(B));
devide(b2,h,N);
}
int main()
{
float a,b;
int N,K;
scanf("%f %f %d %d",&a,&b,&N,&K);
devide(a,b,N);
std::sort(v.begin(),v.end(),comp_obj);
printf("%f\n",v.at(K-1));
//system("pause");
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |