二分。

统计过程如下图:

先统计红线上的个数,然后统计绿线上的个数,然后统计咖啡色线上的个数......一个一个往下统计就可以了。

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0),eps=1e-;
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar();
x = ;
while(!isdigit(c)) c = getchar();
while(isdigit(c)) { x = x * + c - ''; c = getchar(); }
} double r;
double sqrt3=sqrt(3.0); double dis(double x,double y) { return x*x+y*y; } bool check(double x,double y)
{
if(dis(x,y+)-eps>r*r) return ;
if(dis(x,y-)-eps>r*r) return ;
if(dis(x+sqrt3/,y+0.5)-eps>r*r) return ;
if(dis(x+sqrt3/,y-0.5)-eps>r*r) return ;
if(dis(x-sqrt3/,y+0.5)-eps>r*r) return ;
if(dis(x-sqrt3/,y-0.5)-eps>r*r) return ;
return ;
} int main()
{
while(~scanf("%lf",&r))
{
LL ans=, L=,R=(LL),pos;
while(L<=R)
{
LL mid=(L+R)/;
if(check((mid-)*sqrt3,)) pos=mid, L=mid+;
else R=mid-;
}
LL cnt=; double x=,y=-;
while()
{
if(!check(x,y)) break;
LL L=,R=(LL),pp;
while(L<=R)
{
LL mid=(L+R)/;
if(check(x-(mid-)*sqrt3/,y-(mid-)*1.5)) pp=mid, L=mid+;
else R=mid-;
}
pp=+(pp-)*, cnt=cnt+pp, y=y-;
}
ans=*(pos-)++*cnt;
printf("%lld\n",ans);
}
return ;
}

CodeForces 78D Archer's Shot的更多相关文章

  1. CodeForces 312B Archer

    Archer Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ...

  2. hdu 5318 The Goddess Of The Moon

    The Goddess Of The Moon Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

  3. HDU 5318——The Goddess Of The Moon——————【矩阵快速幂】

    The Goddess Of The Moon Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

  4. 2015 Multi-University Training Contest 3 hdu 5318 The Goddess Of The Moon

    The Goddess Of The Moon Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

  5. hdu 5318 The Goddess Of The Moon 矩阵高速幂

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5318 The Goddess Of The Moon Time Limit: 6000/3000 MS ( ...

  6. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  7. Codeforces Round #330 (Div. 1) A. Warrior and Archer 贪心 数学

    A. Warrior and Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/594 ...

  8. 【CodeForces 312B】BUPT 2015 newbie practice #3A Archer

    题 SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the targ ...

  9. Codeforces 595C - Warrior and Archer

    595C - Warrior and Archer 思路:设最后答案的区间为[l,r],那么r-l等于n/2,因为在(l,r)中的点都是其中一个人挖掉的,[0,l)和(r,n]中的点是另一个人挖掉的, ...

随机推荐

  1. GoLang获取struct的tag

    GoLang获取struct的tag内容:beego的ORM中也通过tag来定义参数的. 获取tag的内容是利用反射包来实现的.示例代码能清楚的看懂! package main import ( &q ...

  2. ASP.NET Session丢失问题原因及解决方案

    正常操作情况下会有ASP.NET Session丢失的情况出现.因为程序是在不停的被操作,排除Session超时的可能.另外,Session超时时间被设定成60分钟,不会这么快就超时的. ASP.NE ...

  3. VS2010下C/C++连接MySql数据库的方法

    1. 新建一个C++控制台程序 2. 选择项目 CMySql属性 3. 选择配置属性 C/C++ 常规 附加包含目录 4. 添加包含目录C:\Program Files\MySQL\Connector ...

  4. IOS学习之路二十三(EGOImageLoading异步加载图片开源框架使用)

    EGOImageLoading 是一个用的比较多的异步加载图片的第三方类库,简化开发过程,我们直接传入图片的url,这个类库就会自动帮我们异步加载和缓存工作:当从网上获取图片时,如果网速慢图片短时间内 ...

  5. ajaxFileUpload+struts2实现多文件上传

    以前有介绍过ajaxFileUpload实现文件上传,但那是单文件的,这次介绍多文件上传. 单文件上传参考:http://blog.csdn.net/itmyhome1990/article/deta ...

  6. C#线程同步(转)

    线程同步 在应用程序中使用多个线程的一个好处是每个线程都可以异步执行.对于 Windows 应用程序,耗时的任务可以在后台执行,而使应用程序窗口和控件保持响应.对于服务器应用程序,多线程处理提供了用不 ...

  7. 两种高性能 I/O 设计模式 Reactor 和 Proactor

    两种高性能 I/O 设计模式 Reactor 和 Proactor Reactor 和 Proactor 是基于事件驱动,在网络编程中经常用到两种设计模式. 曾经在一个项目中用到了网络库 libeve ...

  8. [Windows Azure] 使用 Windows Azure 快速搭建 Redis 服务器

    [Windows Azure] 使用 Windows Azure 快速搭建 Redis 服务器   Redis相信玩开源,大数据的朋友们并不陌生,大家最熟悉的使用者就是新浪微博,微博的整体数据缓存都是 ...

  9. spring和redis的整合

    spring和redis的整合-超越昨天的自己系列(7) 超越昨天的自己系列(7) 扯淡:  最近一直在慢慢多学习各个组件,自己搭建出一些想法.是一个涉猎的过程,慢慢意识到知识是可以融汇贯通,举一反三 ...

  10. Drupal与大型网站架构(译)- Large-Scale Web Site Infrastructure and Drupal

    Drupal与大型网站架构(译)- Large-Scale Web Site Infrastructure and Drupal Linuxjournal 网站经典文章翻译,原文地址: Large-S ...