Submission #15306

# Submission time Handle Problem Language Result Execution time Memory
15306 2015-07-12T05:33:26 Z wlgns88 맛있는 과자 (kriii3_A) C++
0 / 33
0 ms 1832 KB
#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
1 Incorrect 0 ms 1832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Halted 0 ms 0 KB -