题解:P1888 三角函数

· · 题解

这如题所述,就是让我们做三角函数。

先画一个直角三角形:

A
|\
| \
|  \
|   \
|    \
|_____\
C      B

正弦值就是对边比斜边也就是 \sin A=\frac{BC}{AB}

须知:斜边是直角三角形中最长的一条边,如果这都不懂就回家重学勾股和三角函数。

又因为边长与对角的正弦值成正比,角越其正弦值越,对应边长也越短。

然后求出最长和最短边,再用 \gcd 约分就行了。

Code:

#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
int max(int A,int B){return (A>B)?A:B;}
int min(int A,int B){return (A<B)?A:B;}

signed main(){
    ios::sync_with_stdio(0),
    cin.tie(0),cout.tie(0);
    int a[3];cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);//sort快速排序
    cout<<a[0]/__gcd(a[0],a[2])<<"/"<<a[2]/__gcd(a[0],a[2]);
    return 0;
}

你们猜为什么是灰名,因为大号红名被机房惨案写不了题解(没封)。