标签:tps ++ 题目 oat for queue bitset bit return
题目链接: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 (你天赋异禀)
标签:tps ++ 题目 oat for queue bitset bit return
原文地址:http://www.cnblogs.com/ACDoge/p/6143107.html