#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1836 KB |
rt_sigaction (syscall #13) was called by the program (disallowed syscall) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |