"HDU 4445" Crazy Tank (violence)

Source: Internet
Author: User

High school physics oblique throw movement, the simple analysis angle fixed down can calculate each cannonball's landing coordinate lnd.

So violence calculates results at different angles.

#include <cstdio> #include "cmath" #include "algorithm" #define LL long long#define DD double#define N 205#define g 9.8 #define EPS 1e-6const DD pi=acos ( -1.0); ll h,l1,l2,r1,r2,n;dd v[n];using namespace Std;int main () {while (scanf ("%d",& N) {scanf ("%d%d%d%d%d", &H,&L1,&R1,&L2,&R2), for (int i=1;i<=n;i++) scanf ("%lf", &v[i]) ; int Lans=0;for (dd d=0;d<1;d+=1./360) {int ans=0,ok=1;dd s=sin (d*pi);dd C=cos (D*PI); for (int i=1;i<=n;i++) {dd vx= V[I]*S;DD vy=v[i]*c;dd t= (sqrt (2*h*g+vy*vy)-vy)/g;dd lnd=vx*t;if (lnd>=l2&&r2>=lnd) {ok=0;break;} if (LND>=L1&&R1>=LND) ans++;} if (OK) Lans=max (Ans,lans);} printf ("%d\n", LANs);}}

  

"HDU 4445" Crazy Tank (violence)

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.