暴力。

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

#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. [LeetCode] 接雨水,题 Trapping Rain Water

    这题放上来是因为自己第一回见到这种题,觉得它好玩儿 =) Trapping Rain Water Given n non-negative integers representing an eleva ...

  2. angularJs $resource自定义方法(待完善)

    配置CompanyService var services = angular.module('liaoyuan.services'); services.factory('CompanyServic ...

  3. Doc常用命令

    1. 获取目录: dir 2. 清屏: cls

  4. Android检测View的可见性

    Android中我们经常会用到判断View的可见行,当然有人会说View.VISIBLE就可以了,但是有时候这个真是满足不了,有时候我们为了优化,在View滚到得不可见的时候或者由于滚到只显示了部分内 ...

  5. 阿里云服务器部署笔记二(python3、Flask、uWSGI、Nginx)

    从git上把项目拉到服务器,项目可以在服务器上运行后,就只需要配置uwsgi和nginx了.它们的逻辑关系是:外部请求->nginx->uwsgi->项目实例. 一.配置uwsgi ...

  6. js中的apply、call、bind

    每个函数都包含两个非继承而来的方法,call()和apply(),可以改变函数内部this的指向 1.apply 用另一个对象替换当前对象,接收两个参数,第一个参数表示需要绑定的this变量,第二个参 ...

  7. Vue组件-使用插槽分发内容

    在使用组件时,我们常常要像这样组合它们: <app> <app-header></app-header> <app-footer></app-fo ...

  8. Ubuntu 14.04 ThinkPad E431无线网卡驱动安装

    Ubuntu 14.04下安装无线网卡驱动. sudo apt-get install linux-headers-generic build-essential dkms  sudo apt-get ...

  9. Linux C中内联汇编的语法格式及使用方法(Inline Assembly in Linux C)【转】

    转自:http://www.linuxidc.com/Linux/2013-06/85221p3.htm 阅读Linux内核源码或对代码做性能优化时,经常会有在C语言中嵌入一段汇编代码的需求,这种嵌入 ...

  10. Linux下基本栈溢出攻击【转】

    转自:http://blog.csdn.net/wangxiaolong_china/article/details/6844415 版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[ ...