Two points.
Statistical processes such as:
Count the number on the red line first, then count the numbers on the green lines, and then count the number on the Brown line ... One by one you can jump down.
#pragmaComment (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 namespaceStd;typedefLong LongLL;Const DoublePi=acos (-1.0), eps=1e-6;voidFile () {freopen ("D:\\in.txt","R", stdin); Freopen ("D:\\out.txt","W", stdout);} Template<classT>inlinevoidRead (T &x) { Charc =GetChar (); X=0; while(!isdigit (c)) C =GetChar (); while(IsDigit (c)) {x = x *Ten+ C-'0'; c =GetChar ();}}DoubleR;DoubleSQRT3=SQRT (3.0);DoubleDisDoubleXDoubleY) {returnx*x+y*y;}BOOLCheckDoubleXDoubley) { if(Dis (x,y+1)-eps>r*r)return 0; if(Dis (x,y-1)-eps>r*r)return 0; if(Dis (x+sqrt3/2, y+0.5)-eps>r*r)return 0; if(Dis (x+sqrt3/2, Y0.5)-eps>r*r)return 0; if(Dis (x-sqrt3/2, y+0.5)-eps>r*r)return 0; if(Dis (x-sqrt3/2, Y0.5)-eps>r*r)return 0; return 1;}intMain () { while(~SCANF ("%LF",&r)) {LL ans=0, l=1, R= (LL)2000000, POS; while(l<=R) {LL mid= (l+r)/2; if(Check (mid-1) *sqrt3,0)) Pos=mid, l=mid+1; Elser=mid-1; } LL CNT=0;Doublex=0, y=-3; while(1) { if(!check (x, y)) Break; LL L=1, R= (LL)2000000, pp; while(l<=R) {LL mid= (l+r)/2; if(Check (x (mid-1) *sqrt3/2, Y (mid-1)*1.5)) Pp=mid, l=mid+1; Elser=mid-1; } pp=1+ (pp-1)*2, CNT=CNT+PP, y=y-3; } ans=6* (pos-1)+1+6*CNT; printf ("%lld\n", ans); } return 0;}
Codeforces 78D Archer ' s Shot