暴力。

题目只要求计算边上的点就可以了,一开始没看清题意,把内部的也算进去了。内部的计算可以延迟标记一下,但这题没有必要。

#include<map>
#include<set>
#include<ctime>
#include<cmath>
#include<queue>
#include<string>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std; int n,xa,xb,ya,yb;
int f[][]; int main()
{
scanf("%d%d%d%d",&xa,&ya,&xb,&yb); xa=xa+, ya=ya+, xb=xb+, yb=yb+; if(xa>xb) swap(xa,xb);
if(ya>yb) swap(ya,yb); scanf("%d",&n); for(int i=;i<=n;i++)
{
int x,y,r; scanf("%d%d%d",&x,&y,&r);
x=x+, y=y+; int jiao1,jiao2;
for(int j=xa;j<=xb;j++)
{
if(j<x-r||j>x+r) continue; int tmp = (int) sqrt(1.0*r*r-1.0*(j-x)*(j-x));
jiao1 = y-tmp;
jiao2 = y+tmp; int L = max(ya,jiao1), R = min(yb,jiao2); if(L>R) continue; f[j][L]++;
f[j][R+]--;
}
} int ans=; for(int i=;i<=;i++)
{
for(int j=;j<=;j++)
{
f[i][j]=f[i][j]+f[i][j-];
}
} for(int i=xa;i<=xb;i++)
{
for(int j=ya;j<=yb;j++)
{
if(i!=xa&&i!=xb&&j!=ya&&j!=yb) continue; if(f[i][j]==) ans++;
}
} printf("%d\n",ans); return ;
}

CodeForces 144B Meeting的更多相关文章

  1. Codeforces 714A Meeting of Old Friends

    A. Meeting of Old Friends time limit per test:1 second memory limit per test:256 megabytes input:sta ...

  2. CodeForces A. Meeting of Old Friends

    2019-05-30 20:19:57 加油!!! sort(a + 1, a + 5); 卡了一会儿 #include <bits/stdc++.h> using namespace s ...

  3. codeforces 782B The Meeting Place Cannot Be Changed (三分)

    The Meeting Place Cannot Be Changed Problem Description The main road in Bytecity is a straight line ...

  4. Codeforces Round #375 (Div. 2) A. The New Year: Meeting Friends 水题

    A. The New Year: Meeting Friends 题目连接: http://codeforces.com/contest/723/problem/A Description There ...

  5. Codeforces Round #371 (Div. 2) A. Meeting of Old Friends 水题

    A. Meeting of Old Friends 题目连接: http://codeforces.com/contest/714/problem/A Description Today an out ...

  6. Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) B. The Meeting Place Cannot Be Changed

    地址:http://codeforces.com/contest/782/problem/B 题目: B. The Meeting Place Cannot Be Changed time limit ...

  7. Jury Meeting CodeForces - 854D

    Jury Meeting CodeForces - 854D 思路:暴力枚举会议开始的那一天(只需用所有向0点飞的航班的那一天+1去枚举即可),并计算所有人此情况下去0点和从0点出来的最小花费. 具体 ...

  8. Codeforces 420 B. Online Meeting

    B. Online Meeting time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  9. Jury Meeting CodeForces - 854D (前缀和维护)

    Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the ...

随机推荐

  1. Java 中 给静态方法 添加泛型 (static <T>)

    今天在用到static方法的时候.想要用泛型.结果不能通过编译. 上网查了一下.其具体写法如下:

  2. 洛谷 P1976 鸡蛋饼

    题目背景 Czyzoiers 都想知道小 x 为什么对鸡蛋饼情有独钟.经过一番逼问,小 x 道出 了实情:因为他喜欢圆. 题目描述 最近小 x 又发现了一个关于圆的有趣的问题:在圆上有2N 个不同的点 ...

  3. [SDOI2011] 染色(Luogu 2486)

    题目描述 输入输出格式 输入格式: 输出格式: 对于每个询问操作,输出一行答案. 输入输出样例 输入样例#1: 6 5 2 2 1 2 1 1 1 2 1 3 2 4 2 5 2 6 Q 3 5 C ...

  4. 【uva11987】带删除的并查集

    题意:初始有N个集合,分别为 1 ,2 ,3 .....n.有三种操件1 p q 合并元素p和q的集合2 p q 把p元素移到q集合中3 p 输出p元素集合的个数及全部元素的和. 题解: 并查集.只是 ...

  5. 【Luogu】 P3928 SAC E#1 - 一道简单题 Sequence2

    [题目]洛谷10月月赛R1 提高组 [算法]递推DP+树状数组 [题解]列出DP递推方程,然后用树状数组维护前后缀和. #include<cstdio> #include<cstri ...

  6. px,em,rem字体单位

    1.px像素(Pixel).相对长度单位.像素px是相对于显示器屏幕分辨率而言的.(引自CSS2.0手册) 2.em是相对长度单位.相对于当前对象内文本的字体尺寸,em存在值继承问题. 浏览器的默认字 ...

  7. $.on方法与$.click()的区别

    1.$.on("click") 支持动态元素绑定事件,该事件是绑定到document上,只要符合条件的元素即可绑定事件,同时$.on()可以绑定多个事件 on方法 on(event ...

  8. python3中处理url异常

    import urllib.request import urllib.error url = 'http://c.telunyun.com/Chart/getJsonData?market=1' d ...

  9. 一个文档让vim飞起来

    原文地址:http://www.cnblogs.com/songfy/p/5635757.html 引言 今天我们特地来讲讲这个vim的配置. vim这东西, 很多人装逼的时候经常会提到, 不过大部分 ...

  10. monkey测试===什么是monkey测试(系列一)转

    本文转自:http://www.cnblogs.com/liu-ke/p/4353926.html Monkey工具使用 一. 什么是Monkey Monkey是Android中的一个命令行工具,可以 ...