Topic Links:
http://acm.hdu.edu.cn/showproblem.php?pid=5761
Main Topic :
Ship in (0,a), ship speed v1, water speed v2 along the x-axis forward, the bow always pointing (0,0), ask to arrive (0,0) time, no solution output infinity.
Topic Ideas:
Mathematical
Mathematics is actually more like physics.
It is obvious that there is no solution v1<=v2.
The integral equation of this problem is then solved by t=a*v1/(v12-v22).
I did not get a formula when I listed the integral equation.
You can look at the half hair thread. Http://images2015.cnblogs.com/blog/786945/201607/786945-20160727001007169-1245551033.png
1 //2 //by Coolxxx3 //4#include <iostream>5#include <algorithm>6#include <string>7#include <iomanip>8#include <memory.h>9#include <time.h>Ten#include <stdio.h> One#include <stdlib.h> A#include <string.h> - //#include <stdbool.h> -#include <math.h> the #defineMin (a) < (b) ( A):(B)) - #defineMax (a) (a) > (b)? ( A):(B)) - #defineABS (a) ((a) >0? ( A):(-(a))) - #defineLowbit (a) (a& (a)) + #defineSqr (a) ((a) * (a)) - #defineSwap (a) (a) ^= (b), (b) ^= (a), (a) ^= (b)) + #defineEPS (1E-8) A #defineJ 10000000 at #defineMAX 0x7f7f7f7f - #definePI 3.1415926535897 - #defineN 1004 - using namespacestd; -typedefLong LongLL; - intCas,cass; in intN,m,lll,ans; - intV1,v2; to intMain () + { - #ifndef Online_judge the //freopen ("1.txt", "R", stdin); * //freopen ("2.txt", "w", stdout); $ #endifPanax Notoginseng inti,j; - //for (scanf ("%d", &cas); cas;cas--) the //for (scanf ("%d", &cas), cass=1;cass<=cas;cass++) + //while (~scanf ("%s", s)) A while(~SCANF ("%d",&N)) the { +scanf"%d%d",&v1,&v2); - if(n==0) puts ("0.000000"); $ Else if(V1<=V2) puts ("Infinity"); $ Elseprintf"%lf\n",Double(N*V1)/(SQR (v1)-Sqr (v2)); - } - return 0; the } - /*Wuyi // the - // Wu */
View Code
"Math" HDU 5761 rower Bo