zoukankan      html  css  js  c++  java
  • 【数学】HDU 5761 Rower Bo

    题目链接:

      http://acm.hdu.edu.cn/showproblem.php?pid=5761

    题目大意

      船在(0,a),船速v1,水速v2沿x轴正向,船头始终指向(0,0),问到达(0,0)用时,无解输出Infinity。

    题目思路:

      【数学】

      说是数学其实更像物理。

      很明显v1<=v2时无解。

      这道题列积分方程然后解出来式子是t=a*v1/(v12-v22).

      我列积分方程的时候少了一个式子没解出来。

      可以看看半根毛线的。http://images2015.cnblogs.com/blog/786945/201607/786945-20160727001007169-1245551033.png

     1 //
     2 //by coolxxx
     3 //
     4 #include<iostream>
     5 #include<algorithm>
     6 #include<string>
     7 #include<iomanip>
     8 #include<memory.h>
     9 #include<time.h>
    10 #include<stdio.h>
    11 #include<stdlib.h>
    12 #include<string.h>
    13 //#include<stdbool.h>
    14 #include<math.h>
    15 #define min(a,b) ((a)<(b)?(a):(b))
    16 #define max(a,b) ((a)>(b)?(a):(b))
    17 #define abs(a) ((a)>0?(a):(-(a)))
    18 #define lowbit(a) (a&(-a))
    19 #define sqr(a) ((a)*(a))
    20 #define swap(a,b) ((a)^=(b),(b)^=(a),(a)^=(b))
    21 #define eps (1e-8)
    22 #define J 10000000
    23 #define MAX 0x7f7f7f7f
    24 #define PI 3.1415926535897
    25 #define N 1004
    26 using namespace std;
    27 typedef long long LL;
    28 int cas,cass;
    29 int n,m,lll,ans;
    30 int v1,v2;
    31 int main()
    32 {
    33     #ifndef ONLINE_JUDGE
    34 //    freopen("1.txt","r",stdin);
    35 //    freopen("2.txt","w",stdout);
    36     #endif
    37     int i,j;
    38 //    for(scanf("%d",&cas);cas;cas--)
    39 //    for(scanf("%d",&cas),cass=1;cass<=cas;cass++)
    40 //    while(~scanf("%s",s))
    41     while(~scanf("%d",&n))
    42     {
    43         scanf("%d%d",&v1,&v2);
    44         if(n==0)puts("0.000000");
    45         else if(v1<=v2)puts("Infinity");
    46         else printf("%lf
    ",double(n*v1)/(sqr(v1)-sqr(v2)));
    47     }
    48     return 0;
    49 }
    50 /*
    51 //
    52     
    53 //
    54 */
    View Code
  • 相关阅读:
    在安装了Anaconda+Pycharm怎么导入OpenCV
    JS--ECMAScript
    JS--DOM
    JS-BOM
    浮动 高度塌陷
    CSS2--字体样式
    CSS2--文本样式
    css2--垂直对齐
    css2--背景
    HTML基础
  • 原文地址:https://www.cnblogs.com/Coolxxx/p/5769258.html
Copyright © 2011-2022 走看看