hdu1785 You Are All Excellent

本着多谢思路的原则,还是把题解及代码记录下啦吧。

用到的atan2函数,atan2(y,x)应该就是与x轴的夹角弧度了,网太渣,没查。

#include<algorithm>
#include<cstdio>
#include<cmath>
using namespace std;
struct point{
    double x,y;
    bool  operator < (const  point&rhs) const {
        return atan2(y,x) < atan2(rhs.y,rhs.x);
    }
}a[110];
  int   main(void)
  {
      int n;
      while(scanf("%d",&n)&&n>=0){
        for(int i=0;i<n;i++){
            scanf("%lf%lf",&a[i].x,&a[i].y);
        }
        sort(a,a+n);
        printf("%.1lf %.1lf",a[0].x,a[0].y);
        for(int i=1;i<n;i++) printf(" %.1lf %.1lf",a[i].x,a[i].y);
        printf("\n");
      }

  }
时间: 2024-11-03 22:10:01

hdu1785 You Are All Excellent的相关文章

HDU1785 You Are All Excellent【余弦】【水题】

You Are All Excellent Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3191    Accepted Submission(s): 1131 Problem Description 本次集训队共有30多人参加,毫无疑问,你们都是很优秀的,但是由于参赛名额有限,只能选拔部分队员参加省赛.从学校的角度,总是希望选拔出

hdu 1785(You Are All Excellent)(数学函数atan2(y.x)返回(x,y)的反正切值)

You Are All Excellent Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2945    Accepted Submission(s): 1061 Problem Description 本次集训队共有30多人参加,毫无疑问,你们都是很优秀的,但是由于参赛名额有限,只能选拔部分队员参加省赛.从学校的角度,总是希望选拔出

SDJZU_新生_排序_You Are All Excellent(sort方法)

You Are All Excellent Crawling in process... Crawling failed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description 本次集训队共有30多人参加,毫无疑问,你们都是很优秀的,但是由于参赛名额有限,只能选拔部分队员参加省赛.从学校的角度,总是希望选拔出最优秀的18人组成6支队伍来代表学校.但是,大家也知道,要想做到完全

excellent cushioning and also vitality go back with this boot

The particular manufactured fine mesh higher almost addresses the complete boot. Here is the sort of higher create in which blissfully permits the particular ft . to keep great and also dried up regardless how extended the particular work will be or

(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 #i

DB Query Analyzer 6.03, the most excellent Universal DB Access tools on any Microsoft Windows OS

?  ?DB Query Analyzer 6.03, the most excellent Universal database Access tools on any Microsoft Windows OS DB Query Analyzer is presented by Master Genfeng, Ma from Chinese Mainland. It has English version named 'DB Query Analyzer' and Simplified Chi

杭电 HDU ACM 1785 You Are All Excellent

 You Are All Excellent Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3874    Accepted Submission(s): 1270 Problem Description 本次集训队共有30多人参加,毫无疑问,你们都是很优秀的,但是由于参赛名额有限,只能选拔部分队员参加省赛.从学校的角度,总是希望

HDU 1785 You Are All Excellent(斜率排序+结构体)

You Are All Excellent Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4651    Accepted Submission(s): 1558 Problem Description 本次集训队共有30多人参加,毫无疑问,你们都是很优秀的,但是由于参赛名额有限,只能选拔部分队员参加省赛.从学校的角度,总是希望选拔出

A - Excellent Team

Description Gibbs: Next! First Pirate: My wife ran off with my dog and I'm drunk for a month. Gibbs: Perfect. Next! Second Pirate: Me have one arm and a bum leg. Gibbs: It's the crow's nest for you. Next! In Tortuga the Captain Jack Sparrow and Will