Submission #15306

#TimeUsernameProblemLanguageResultExecution timeMemory
15306wlgns88맛있는 과자 (kriii3_A)C++98
0 / 33
0 ms1832 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...