JD_Source Code for problem 1259
来源:互联网 发布:海盗湾电影源码 编辑:程序博客网 时间:2024/06/06 16:48
题目链接:http://acm.jlu.edu.cn/joj/showproblem.php?pid=1259
- #include <stdio.h>
- #include <math.h>
-
- struct Point
- {
- double x;
- double y;
- };
-
- struct Figure
- {
- char type;
- Point p1;
- Point p2;
- double r;
- };
-
- Figure fig[11];
- Point pt[100];
-
-
- bool In(const Point& p,const Figure& f)
- {
- if(f.type == 'r')
- {
- if(p.x > f.p1.x && p.x < f.p2.x && p.y > f.p2.y && p.y < f.p1.y)
- return true;
- return false;
- }
- else
- {
- if(sqrt((p.x -f.p1.x) * (p.x -f.p1.x) + (p.y - f.p1.y) * (p.y - f.p1.y)) < f.r)
- return true;
- return false;
- }
- }
-
- int main(int argc, char* argv[])
- {
- int f_count,p_count;
- f_count = 0;
- while(true)
- {
- if(scanf("%c",&fig[f_count].type) == EOF)
- return 0;
- else if(fig[f_count].type == '*')
- break;
- else if(fig[f_count].type == 'r')
- scanf("%lf%lf%lf%lf",&fig[f_count].p1.x,&fig[f_count].p1.y,
- &fig[f_count].p2.x,&fig[f_count].p2.y);
- else
- scanf("%lf%lf%lf",&fig[f_count].p1.x,&fig[f_count].p1.y,&fig[f_count].r);
- getchar();
- f_count++;
- }
-
- p_count = 0;
- while(true)
- {
- if(scanf("%lf%lf",&pt[p_count].x,&pt[p_count].y) == EOF)
- return 0;
- else if(fabs(pt[p_count].x - 9999.9) < 1e-6 && fabs(pt[p_count].y - 9999.9) < 1e-6)
- break;
- p_count++;
- }
-
- int i,j;
- bool in;
- for(i = 0;i < p_count;i++)
- {
- in = false;
- for(j = 0;j < f_count;j++)
- if(In(pt[i],fig[j]))
- {
- printf("Point %d is contained in figure %d/n",i + 1,j + 1);
- in = true;
- }
- if(!in)
- printf("Point %d is not contained in any figure/n",i + 1);
- }
- return 0;
- }
- JD_Source Code for problem 1259
- JD_Source Code for problem 1581
- JD_Source Code for problem 1379
- ZD_source code for problem 2971
- BD_source code for problem 1555
- lingo sample code for a QP problem
- Mysql Drump Code for Chinese problem fixed
- problem 1111(code)
- XDU Problem 1016 - Code
- Code Review for Java code
- This is the first problem for test. Since all we know the ASCII code, your job is simple: Input numb
- (code jam)Problem C. Numbers
- Code Jam Problem D. GoroSort
- Problem and Solution Code Snippets
- java source code attachment problem
- c# code for session
- For WeiWei Server Code
- C# code for word
- 对抗瑞星文件监控 恢复fsd
- WebKit 学习笔记(5) -- qt javascript 扩展
- 在Eclipse,netbeans中添加中文javadoc
- 存储转发机制优化系统测试报告
- 硬件还是软件
- JD_Source Code for problem 1259
- 关于HTTP协议头部Content-Type 信息的一张表
- 一位80年代初生人的游戏史
- BD_source code for problem 1555
- IO Stream Manipulator
- flex代碼(3)
- 最简单的 DIV + Javascript 分页演示代码
- 货品管理系统
- SQL语句操作时间