题意简单。

由于没有注意到椭圆不一定是在圆心。。贡献无数的wa。。。。。

#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<stdlib.h>
#include<math.h>
using namespace std; const int maxn = 555;
const int maxm = 555;
const double eps = 1e-8; struct Node{
char name[55];
char nation[55];
int sum;
int id;
double x,y;
}p[ maxn ]; struct Cir{
double r;
double x,y;
int val;
}c1[ maxm ];
struct Cir2{
double x,y;
double a,b;
int val;
}c2[ maxm ];
struct Point {
double x,y;
};
struct Ploy{
Point pnt[ maxn ];
int cnt;
int val;
}ploy[ maxm ]; int od[ maxm ]; int cmp( Node a,Node b ){
if( a.sum!=b.sum ) return a.sum>b.sum;
else return a.id<b.id;
} double dis( double x1,double y1,double x2,double y2 ){
return ( (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2) );
} bool InCir( Node aim,int ID ){
double dd = dis( aim.x,aim.y,c1[ID].x,c1[ID].y );
if( dd<=c1[ID].r*c1[ID].r ) return true;
else return false;
} bool InCir2( Node aim,int ID ){
double dd = (aim.x-c2[ID].x)*(aim.x-c2[ID].x)/(c2[ID].a*c2[ID].a)+(aim.y-c2[ID].y)*(aim.y-c2[ID].y)/(c2[ID].b*c2[ID].b);
if( dd<=1.0 ) return true;
else return false;
} int D( double x ){
return x<-eps?-1:x>eps;
} double det( Point a,Point b,Point c ){
return (b.x-a.x)*(c.y-a.y)-(c.x-a.x)*(b.y-a.y);
} int InPloy1( int n,double xx,double yy,Point pnt[] ){
Point q;
q.x = xx,q.y = yy;
int i,s[3] = {1,1,1};
pnt[n] = pnt[0];
for( int i=0;i<n&&s[0]|s[2];i++ ){
s[ D(det(pnt[i],pnt[i+1],q))+1 ] = 0;
}
return s[0]|s[2];
}
int InPloy2( int n,double xx,double yy,Point pnt[] ){
Point q;
q.x = xx;
q.y = yy;
int i,s[3] = {1,1,1};
pnt[n] = pnt[0];
for( int i=0;i<n&&s[1]&&s[0]|s[2];i++ ){
s[ D(det(pnt[i],pnt[i+1],q))+1 ] = 0;
}
return s[1]&&s[0]|s[2];
} void init(){
for( int i=0;i<maxn;i++ )
p[i].sum = 0;
} void test( int n ){
for( int i=1;i<=n;i++ ){
printf("name = %s, sum = %d\n",p[i].name,p[i].sum);
}
} int main(){
int T;
scanf("%d",&T);
int Case = 1;
while( T-- ){
int n,m;
scanf("%d",&m);
init();
char str[ 55 ];
for( int i=1;i<=m;i++ ){
scanf("%s",str);
if( str[0]=='C' ){
od[ i ] = 1;
scanf("%lf%lf%lf%d",&c1[ i ].x,&c1[ i ].y,&c1[ i ].r,&c1[ i ].val);
}
else if( str[0]=='E' ){
od[ i ] = 2;
scanf("%lf%lf%lf%lf%d",&c2[ i ].x,&c2[ i ].y,&c2[ i ].a,&c2[ i ].b,&c2[ i ].val);
}
else {
od[ i ] = 3;
int cc;
scanf("%d",&cc);
for( int j=0;j<cc;j++ ){
scanf("%lf%lf",&ploy[i].pnt[j].x,&ploy[i].pnt[j].y);
}
ploy[i].cnt = cc;
scanf("%d",&ploy[i].val);
}
}
scanf("%d",&n);
for( int i=1;i<=n;i++ ){
scanf("%s%s%lf%lf",p[i].name,p[i].nation,&p[i].x,&p[i].y);
//p[i].sum = 0;
p[i].id = i;
}
for( int i=1;i<=n;i++ ){
for( int j=1;j<=m;j++ ){
if( od[j]==1&&InCir( p[i],j )==true ){
p[i].sum += c1[j].val;
}
else if( od[j]==2&&InCir2( p[i],j )==true ){
p[i].sum += c2[j].val;
}
else if( od[j]==3&&(InPloy1( ploy[j].cnt,p[i].x,p[i].y,ploy[j].pnt )||InPloy2( ploy[j].cnt,p[i].x,p[i].y,ploy[j].pnt )) ){
p[i].sum += ploy[j].val;
}
}
} sort( p+1,p+1+n,cmp );
//test( n );
printf("Case %d:\n",Case ++ );
int Gold = 0;
if( p[1].sum<=0 ) continue;
int flag = 1;
for( int i=1;i<=n;i++ ){
if( p[i].sum==p[1].sum&&p[1].sum>0 ){
printf("Gold Medal: %s from %s got %d point(s)\n",p[i].name,p[i].nation,p[i].sum);
Gold ++ ;
flag = i;
}
else break;
}
if( p[flag+1].sum<=0 ) continue;
if( Gold>=3 ) continue;
int Silver = 0;
int temp = flag+1;
bool f = false;
for( int i=temp;i<=n;i++ ){
if( p[i].sum==p[temp].sum && p[i].sum>0 ){
flag = i;
Silver ++ ;
if( Gold<=1 ) printf("Silver Medal: %s from %s got %d point(s)\n",p[i].name,p[i].nation,p[i].sum);
else{
f = true;
printf("Bronze Medal: %s from %s got %d point(s)\n",p[i].name,p[i].nation,p[i].sum);
}
}
else break;
}
if( Silver+Gold>=3||f==true ) continue;
if( p[flag+1].sum<=0 ) continue;
for( int i=flag+1;i<=n;i++ ){
if( p[i].sum==p[flag+1].sum&&p[i].sum>0 ){
printf("Bronze Medal: %s from %s got %d point(s)\n",p[i].name,p[i].nation,p[i].sum);
}
else break;
}
}
return 0;
}

FZU-1925+几何的更多相关文章

  1. ACM: FZU 2110 Star - 数学几何 - 水题

     FZU 2110  Star Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u  Pr ...

  2. fzu Problem 2148 Moon Game(几何 凸四多边形 叉积)

    题目:http://acm.fzu.edu.cn/problem.php?pid=2148 题意:给出n个点,判断可以组成多少个凸四边形. 思路: 因为n很小,所以直接暴力,判断是否为凸四边形的方法是 ...

  3. fzu 2035 Axial symmetry(枚举+几何)

    题目链接:fzu 2035 Axial symmetry 题目大意:给出n个点,表示n边形的n个顶点,判断该n边形是否为轴对称图形.(给出点按照图形的顺时针或逆时针给出. 解题思路:将相邻两个点的中点 ...

  4. FZU 2140 Forever 0.5 (几何构造)

    Forever 0.5 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit  ...

  5. FZU Moon Game(几何)

    Accept: 710    Submit: 2038 Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description Fa ...

  6. FZU 2140 Forever 0.5(找规律,几何)

    Problem 2140 Forever 0.5 Accept: 371 Submit: 1307 Special Judge Time Limit: 1000 mSec Memory Limit : ...

  7. fzu 1015 土地划分(判断线段相交+求出交点+找规律)

    链接:http://acm.fzu.edu.cn/problem.php?pid=1015  Problem 1015 土地划分 Accept: 714    Submit: 1675Time Lim ...

  8. 关于Three.js基本几何形状之SphereGeometry球体学习

    一.有关球体SphereGeometry构造函数参数说明 <1>.SphereGeometry(radius, widthSegments, heightSegments, phiStar ...

  9. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  10. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

随机推荐

  1. 玩转Win32开发(2):完整的开发流程

          上一篇中我给各位说了一般人认为C++中较为难的东西——指针.其实对于C++,难点当然不局限在指针这玩意儿上,还有一些有趣的概念,如模板类.虚基类.纯虚函数等,这些都是概念性的东西,几乎每一 ...

  2. ssh免密码登陆远程服务器

    ssh免密码登陆远程服务器 在使用windows下的cygwin或者在linux下使用Terminal进行远程服务器登陆测试的时候总是会要求输入账号密码,对于此我们可以使用ssh将公钥放在服务器上的方 ...

  3. VMware 虚拟机(linux)增加根目录磁盘空间 转自

    转自 http://wenku.baidu.com/link?url=WZDgESO0oXqYfhPYOWFalZsMglS0HKtLw7t6ICRs_sJ_sfPc85RpxsqKMwqSniis0 ...

  4. C#类、静态类

    C#是面向对象(object-oriented)类型的计算机语言,使用类(class)来体现面向对象的概念. 分类(classification) 我们在现实世界中,会遇到很多被分类的事物.例如,动物 ...

  5. angularjs深入理解向指令传递数据,双向绑定机制

    <!DOCTYPE html> <html lang="zh-CN" ng-app="app"> <head> <me ...

  6. js深入理解"闭包"

    一.变量的作用域 要理解闭包,首先必须理解Javascript特殊的变量作用域. 变量的作用域无非就是两种:全局变量和局部变量. Javascript语言的特殊之处,就在于函数内部可以直接读取全局变量 ...

  7. PHP扩展开发(6) - VS2012下strncasecmp和fopen函数warning

    1. fopen   warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s i ...

  8. Entity Framework With Mysql 之Code First

    Entity Framework 4.0现在也可以支持Mysql数据库了,这篇文章将向你展示如何用Code First的方式来实现. 1.首先新建一个项目,在项目中用NuGet添加如下引用: 2.在w ...

  9. 一个ajax实现表单上传文件的神器 formdata

    通过传统的form表单提交的方式上传文件: $.ajax({ url : "http://localhost:8080/STS/rest/user", type : "P ...

  10. cf B. Flag Day

    http://codeforces.com/contest/357/problem/B #include <cstdio> #include <cstring> #includ ...