문제 개요
종이를 접자
아이디어
정말 그냥 계산이고 코드 구현은 거들 뿐...
포스트잇 쪼끄만거 접어서 이리저리 써봤다,, 수능수학 푸는 기분 ㅎ...
코드
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<math.h>
#include<stack>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
double a, b, x, ans1, ans2, tmp1, tmp2, k;
cin >> a >> b;
x = (a * sqrt(a*a + b * b) - a * a) / b;
ans1 = sqrt(a*a + x * x) / 2;
double cos_2o = a / (sqrt(a*a + b * b));
double sin_o = sqrt((1 - cos_2o) / 2);
k = sqrt(a*a + b * b) - a;
tmp1 = a * sin_o;
tmp2 = k * sin_o;
ans2 = tmp1 + tmp2;
cout << ans1 << " " << ans2;
return 0;
}
세로는 tmp1+tmp2로 계산했고
가로는 sqrt(a^2+x^2) 길이의 절반이다. 왜 그런지는 종이 접어보면 앎.