二分。

统计过程如下图:

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

#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. 推荐系列:最小与最大[DP+余式定理]

    最小与最大 [问题描述] 做过了乘积最大这道题,相信这道题也难不倒你. 已知一个数串,可以在适当的位置加入乘号(设加了k个,当然也可不加,即分成k+1个部分),设这k+1个部分的乘积(如果k=0,则乘 ...

  2. C++库研究笔记——函数名的宏定义

    6.47 Function Names as Strings:http://gcc.gnu.org/onlinedocs/gcc/Function-Names.html GCC provides th ...

  3. [转]Building a Basic Fuzzer with GDB: The Five Minute GDB Scripting Tutorial

    link:http://www.praetorian.com/blog/building-a-basic-fuzzer-with-gdb-the-five-minute-gdb-scripting-t ...

  4. c语言,求字符数组的长度

    练手代码,适用初级码农: #include<stdlib.h> #include<stdio.h> #include<assert.h> int count(con ...

  5. SqlBulkCopy实现大容量数据快速插入数据库中

    一般情况下,我们手写sqlhelper类,在此类中定义一个数据插入到数据库的一个方法.将数据库连接密封在using()的语句中.using显示了Idispose接口.可以及时释放数据库连接资源.代码如 ...

  6. 把项目做成jar包

    方法一.在eclipse3.1中把项目做成jar包步骤. 打包前的工作. 在项目下创建一个文件夹,名为META-INF,再在其下创建文件MANIFEST.MF 编辑的内容如下: Manifest-Ve ...

  7. Webx小应用的实现整理与分析

    Webx小应用的实现整理与分析 初次在园子里与大家分享自己的所学,欢迎各种指点~ By 仰城 2013-08-07 学习一段时间webx.ibatis.spring以及maven的基本知识之后,应用它 ...

  8. DIV+CSS命名参考

    用了一段CSS布局设计网页,发现自己的命名有点混乱,完全按照自己的想法命名,虽然没什么影响,有不给别人看源文件,但是工作室有时候和团队合作完成项目的时候,就遇到麻烦了,要修改一个地方相当的费事.所以还 ...

  9. Sublime Text快捷键:

    Ctrl+Shift+P:打开命令面板 Ctrl+P:搜索项目中的文件 Ctrl+G:跳转到第几行 Ctrl+W:关闭当前打开文件 Ctrl+Shift+W:关闭所有打开文件 Ctrl+Shift+V ...

  10. linux php 安装GD库

    linux下为php添加GD库的步骤如下: 一.下载 gd-2.0.33.tar.gz http://www.boutell.com/gd/ jpegsrc.v6b.tar.gz http://www ...