CodeForces 144B Meeting
暴力。
题目只要求计算边上的点就可以了,一开始没看清题意,把内部的也算进去了。内部的计算可以延迟标记一下,但这题没有必要。
#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的更多相关文章
- 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 ...
- CodeForces A. Meeting of Old Friends
2019-05-30 20:19:57 加油!!! sort(a + 1, a + 5); 卡了一会儿 #include <bits/stdc++.h> using namespace s ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- Jury Meeting CodeForces - 854D
Jury Meeting CodeForces - 854D 思路:暴力枚举会议开始的那一天(只需用所有向0点飞的航班的那一天+1去枚举即可),并计算所有人此情况下去0点和从0点出来的最小花费. 具体 ...
- Codeforces 420 B. Online Meeting
B. Online Meeting time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- Jury Meeting CodeForces - 854D (前缀和维护)
Country of Metropolia is holding Olympiad of Metrpolises soon. It mean that all jury members of the ...
随机推荐
- 上下文路径request.getContextPath();与${pageContext.request.contextPath}
(1) request.getContextPath();与${pageContext.request.contextPath}都是获取上下文路径: 1. request.getContextPath ...
- sublime 常用插件 感觉比较全了 够用了
插件介绍 Package Control 功能:安装包管理 简介:sublime插件控制台,提供添加.删除.禁用.查找插件等功能 使用:https://sublime.wbond.net/instal ...
- 获取数据源数据的实现---Architecting Android
UserRepository,这个接口,描述了Repository提供给用户的功能就是getUsers,getUser(ID).用户只管使用,其它细节无需理会. /** * Interface tha ...
- AndroidStudio获得发布版安全码SHA1
耗了一下午才搞定 在cmd中: 1.打开keytool的目录:即JDK的安装目录 2.输入口令: (E:\tenyears\tenyears\app是keystore文件的目录)
- 启动Eclipse时,弹出failed to load the jni shared library
JDK版本和Eclipse版本不同的问题,JDK版本为64位,Eclipse版本为32位.
- JavaWeb使用Session防止表单重复提交
在平时开发中,如果网速比较慢的情况下,用户提交表单后,发现服务器半天都没有响应,那么用户可能会以为是自己没有提交表单,就会再点击提交按钮重复提交表单,我们在开发中必须防止表单重复提交. 1.什么是表单 ...
- Linux汇编教程03:大小比较操作
我们在上一讲中,简单了解了汇编程序大概的样子.接下来我们来了解一下,汇编程序的大小比较操作.所以我们以编写寻找一堆数中的最大值作为学习的载体. 在编写程序之前,先要分析我们的目的,在得出解决方案. 目 ...
- 安全测试===burpsuit指南
网址: https://www.gitbook.com/book/t0data/burpsuite/details 引子 刚接触web安全的时候,非常想找到一款集成型的渗透测试工具,找来找去,最终选择 ...
- Redis 3.0 编译安装
Redis 3.0 编译安装 http://www.xuchanggang.cn/archives/991.html
- mssql批量刷新多个表的数据
DECLARE @SQL VARCHAR(MAX)SELECT @SQL=ISNULL(@SQL,'')+' UPDATE '+NAME+' SET B=3 WHERE B=2'FROM SYSOBJ ...