Within the circle, the integer point farthest from the center Hiho the 111th Week farthest point

Source: Internet
Author: User

1 //within the circle, the integer point farthest from the center Hiho the 111th week farthest point2 //idea: Direct violence absolute T3 //determine the X range, within each X range, the point farthest from the center of the circle must be the point at both ends of the y-axis. Enumerate the ranges of x and then compare y4 //O (n)5 6#include <bits/stdc++.h>7 using namespacestd;8 #defineLL Long Long9 Const DoubleINF =123456789012345.0;Ten ConstLL MOD =100000000LL; One Const intN =1e7+Ten; A #defineCLC (A, B) memset (A,b,sizeof (a)) - Const DoubleEPS = 1e-7; - voidFre () {freopen ("In.txt","R", stdin);} the voidFreout () {freopen ("OUT.txt","W", stdout);} -InlineintRead () {intx=0, f=1;CharCh=getchar (); while(ch>'9'|| ch<'0') {if(ch=='-') f=-1; Ch=getchar ();} while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; Ch=getchar ();}returnx*F;} -  - DoubleDisDoubleADoubleBDoubleCDoubled) { +     return(a-c) * (a-c) + (b-d) * (b-d); - } + intMain () { A     DoubleX,y,r; at     Doublelen=-1; -     intans_y,ans_x; -scanf"%LF%LF%LF",&x,&y,&R); -      for(DoubleI=floor (x+r); I>=ceil (x-r); i--){ -         DoubleD= (Double) sqrt (r*r-(i-x) * (I-x)); -         DoubleY1=floor (D+y), Y2=ceil (yd); in         if(Dis (x,y,i,y1) >Len) { -len=dis (x,y,i,y1); toans_x=i,ans_y=Y1; +         } -         if(Dis (x,y,i,y2) >Len) { thelen=dis (x,y,i,y2); *ans_x=i,ans_y=Y2; $         }Panax Notoginseng     } -printf"%d%d\n", ans_x,ans_y); the     return 0; +}

Within the circle, the integer point farthest from the center Hiho the 111th Week farthest point

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.