I think:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
struct port
{
long long x,y,l,r;
};
int cmp(const void *a,const void *b)
{
struct port *x=(struct port *)a;
struct port *y=(struct port *)b;
return x->l - y->l; }
struct port p[1000000];
int main(void)
{
long long wayLen,d,i,v,sum;
long long c,tem;
while(scanf("%lld%lld%lld",&wayLen,&d,&v)!=EOF)
{
sum=1;
for(i=0; i<v; i++)
{
scanf("%lld%lld",&p[i].x,&p[i].y);
c=sqrt(d*d-p[i].y*p[i].y);
p[i].r=c+p[i].x;
p[i].l=p[i].x-c;
}
qsort(p,v,sizeof(p[0]),cmp);
tem=p[0].r;
for(i=1; i<v; i++)
{
if(p[i].l<=tem)
continue;
else
{
tem=p[i].r;
++sum;
}
}
printf("%lld\n",sum);
}
return 0;
}

  

高速公路(Highway,ACM/ICPC SEERC 2005,UVa1615)的更多相关文章

  1. [C++]最小生成元 (Digit Generator, ACM/ICPC Seoul 2005, UVa1583)

    Question 例题3-5 最小生成元 (Digit Generator, ACM/ICPC Seoul 2005, UVa1583) 如果x+x的各个数字之和得到y,就是说x是y的生成元.给出n( ...

  2. 分子量 (Molar Mass,ACM/ICPC Seoul 2005,UVa1586)

    习题 3-3 分子量 (Molar Mass,ACM/ICPC Seoul 2005,UVa1586) 给出一种物质的分子式(不带括号),求分子量.本题中的分子式只包含4种原子,分别为C,H,O,N, ...

  3. 生成元(Digit Generator, ACM/ICPC Seoul 2005, UVa1583)

    如果x加上x的各个数字之和得到y,就说x是y的生成元.给出n(1≤n≤100000),求最小 生成元.无解输出0.例如,n=216,121,2005时的解分别为198,0,1979. [分析] 本题看 ...

  4. 得分(Score,ACM/ICPC Seoul 2005,UVa 1585)

    #include<stdio.h> int main(void) { char b; int t,cou,sum; scanf("%d",&t); getcha ...

  5. 生成元(Digit Generator ,ACM/ICPC Seoul 2005 ,UVa 1583)

    生成元:如果 x 加上 x 各个数字之和得到y,则说x是y的生成元. n(1<=n<=100000),求最小生成元,无解输出0. 例如:n=216 , 解是:198 198+1+9+8=2 ...

  6. 得分(Score, ACM/ICPC Seoul 2005,UVa 1585)

    #include<cstdio>#include<cstdlib>#include<cstring>int main(){ char s[80];//输入OOXXO ...

  7. 生成元(Digit Generator,ACM/ICPC Seoul 2005,UVa 1583)

    #include<cstdio>#include<cstdlib>#include<cstring>using namespace std;int t, n, a, ...

  8. UVa 1585 - Score - ACM/ICPC Seoul 2005 解题报告 - C语言

    1.题目大意 给出一个由O和X组成的字符串(长度为80以内),每个O的得分为目前连续出现的O的数量,X得分为0,统计得分. 2.思路 实在说不出了,这题没过脑AC的.直接贴代码吧.=_= 3.代码 # ...

  9. hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup

    hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 ...

随机推荐

  1. C语言 百炼成钢11

    //题目31:请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续 //判断第二个字母. #define _CRT_SECURE_NO_WARNINGS #include<st ...

  2. C语言 百炼成钢4

    //题目10:打印楼梯,同时在楼梯上方打印两个笑脸. #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdli ...

  3. 利用link标签的disabed属性大面积的对其他标签元素的CSS样式进行替换操作

    由于平时对元素样式的控制基本上只是3,4个,所以一般用Jquery的时候直接使用$(element).css();这个方法,或者使用$(element).addClass()方法完成样式操作.对于小范 ...

  4. 关于 iOS 10 中 ATS / HTTPS /2017 问题

    本文于 2016 年 11 月 28 日按照 Apple 最新的文档和 Xcode 8 中的表现进行了部分更新. WWDC 15 提出的 ATS (App Transport Security) 是 ...

  5. .NET MVC控制器向视图传递数据的四种方式

    .NET MVC控制器向视图传递数据的四种方式: 1.ViewBag  ViewBag.Mvc="mvc"; 2.ViewData ViewBag["Mvc"] ...

  6. [BZOJ1876][SDOI2009]superGCD(高精度)

    题目:http://www.lydsy.com:808/JudgeOnline/problem.php?id=1876 分析: 以为辗转相减会TLE呢……但是好像没这个数据……就这么水过去了…… 辗转 ...

  7. MyEclipse内存不足问题

    1.修改eclipse.ini 在Myeclipse安装目录下G:\MyEclipse8.5\Genuitec\MyEclipse 8.5有一个myeclipse.ini配置文件,设置如下: -vma ...

  8. reboot-css

    dd, label { margin-bottom: .5rem; }abbr[title] { text-decoration: none; }abbr[title] { border-bottom ...

  9. codevs 1082 线段树练习3 模板题

    #include<cstdio> #include<cstring> #include<algorithm> using namespace std; ],sum[ ...

  10. JavaWeb 项目开发中的技术总结

    前言: 在项目开发过程中的一点点指导思想 1.环境准备 win系统 Eclipse 开发平台 maven tomcat Mysql 数据库,mysql5.6 操作数据库的jar 包 JDBC 连接数据 ...