(HDU)1785 -- You Are All Excellent (你天赋异禀)

Posted ACDoge

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了(HDU)1785 -- You Are All Excellent (你天赋异禀)相关的知识,希望对你有一定的参考价值。

题目链接:https://vjudge.net/problem/HDU-1785

角度变成tan x=k,在第一象限递增的,所以转化一下问题就好了。

 1 #include <iostream>
 2 #include <queue>
 3 #include <stack>
 4 #include <map>
 5 #include <set>
 6 #include <bitset>
 7 #include <cstdio>
 8 #include <algorithm>
 9 #include <cstring>
10 #include <climits>
11 #include <cstdlib>
12 #include <cmath>
13 #include <time.h>
14 
15 using namespace std;
16 
17 
18 int main()
19 {
20     int n,i,j;
21     float s,a[101],b[101],c[101];
22     while(scanf("%d",&n)&&n>=0)
23     {
24         for(i=0;i<n;i++)
25         {
26             scanf("%f%f",&a[i],&b[i]);
27             c[i]=a[i]/b[i];
28         }
29         for(i=0;i<n-1;i++)
30         {
31             for(j=i+1;j<n;j++)
32             {
33                 if(c[j]>c[i])
34                 {
35                     s=a[j];a[j]=a[i];a[i]=s;
36                     s=b[j];b[j]=b[i];b[i]=s;
37                     s=c[j];c[j]=c[i];c[i]=s;
38                 }
39             }
40         }
41         if(n>0)
42             printf("%.1f %.1f",a[0],b[0]);
43         for(i=1;i<n;i++)
44         {
45             printf(" %.1f %.1f",a[i],b[i]);
46         }
47         printf("\n");
48     }
49     return 0;
50 }

 

以上是关于(HDU)1785 -- You Are All Excellent (你天赋异禀)的主要内容,如果未能解决你的问题,请参考以下文章

hdu 4283You Are the One

HDU 1075 What Are You Talking About

[HDU 1075]What Are You Talking About

HDU 4283---You Are the One(区间DP)

刷题总结——you are the one(hdu4283)

HDU-4283 You Are the One (区间DP)