二分。

统计过程如下图:

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

#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. C#串口通信程序详解

    C#串口通信程序详解 摘要:创建C#串口通信程序需要注意什么呢?创建C#串口通信程序的步骤是什么?那么本文就向你详细介绍创建C#串口通信程序集体的内容. 在.NET平台下创建C#串口通信程序,.NET ...

  2. Xcode开发和调试总结

    Xcode是iOS开发主要的工具.IDE.关于Xcode的细枝末节,可以参考苹果的官方文档或者众多的说明.此文档主要涉及常用开发和调试注意事项,参考版本为Xcode 5.1.1. 目标设置: 在此,我 ...

  3. vector如何进行局部排序

    对于vector的全体排序,我们知道sort(vv.begin(),vv.end())来进行的. 但是对于如果是局部排序的话,比如,vector有100个元素,但我只想对10-80之间的数进行排序,如 ...

  4. c#中如何跨线程调用windows窗体控件?

    我们在做winform应用的时候,大部分情况下都会碰到使用多线程控制界面上控件信息的问题.然而我们并不能用传统方法来做这个问题,下面我将详细的介绍.首先来看传统方法: public partial c ...

  5. 构建一个真实的应用电子商务SportsStore9

    使用MVC4,Ninject,EF,Moq,构建一个真实的应用电子商务SportsStore(九) 实在不好意思,好久没有更新了,我不想找些客观原因来解释,只想请大家见谅!现在我们继续我们的项目,客户 ...

  6. service structure flowchart with full stack functionality in a brife map

    More functionality will be added and running This diagram is just an easy chart for people to digest

  7. 常用PHP正则表达式

    获取所有图片网址preg_match_all(“/ src=(\”|\’){0,}(http:\/\/(.+?))(\”|\’|\s|>)/is”,$text,$img); 匹配中文字符的正则表 ...

  8. mongDB

    MongoDB[第一篇]MongodDB初识   NoSQL介绍 一.NoSQL简介 NoSQL,全称是”Not Only Sql”,指的是非关系型的数据库. 非关系型数据库主要有这些特点:非关系型的 ...

  9. Hamilton

    import java.util.Vector; class Hamilton { int start; int a[][]; int len; int x[]; // 记录回路 boolean fl ...

  10. memcache研究

    memcache研究 最近开发了一个数据库,该数据库是利用共享内存做的,测试了下增删改查的性能,想与memcached数据库做个对比,故研究下memcached. 那什么是memcached? mem ...