• LightOJ 1311 Unlucky Bird (物理题)


    题意:有点长,意思是说有一个鸟,在两列火车之间不停的来回飞,两列相距为d时,都开始减速,直到最后停止下来,正好是相距0米,

    现在给定两列车的速度和减速时的加速度,和鸟的速度求 d 和鸟飞过的路程。

    析:就是一个简单的追及相遇问题,注意的是求的飞行时间时,要计算两列火车制动时间最长的那个。

    代码如下:

    #pragma comment(linker, "/STACK:1024000000,1024000000")
    #include <cstdio>
    #include <string>
    #include <cstdlib>
    #include <cmath>
    #include <iostream>
    #include <cstring>
    #include <set>
    #include <queue>
    #include <algorithm>
    #include <vector>
    #include <map>
    #include <cctype>
    #include <cmath>
    #include <stack>
    #include <sstream>
    #define debug() puts("++++");
    #define gcd(a, b) __gcd(a, b)
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define freopenr freopen("in.txt", "r", stdin)
    #define freopenw freopen("out.txt", "w", stdout)
    using namespace std;
    
    typedef long long LL;
    typedef unsigned long long ULL;
    typedef pair<int, int> P;
    const int INF = 0x3f3f3f3f;
    const LL LNF = 1e16;
    const double inf = 0x3f3f3f3f3f3f;
    const double PI = acos(-1.0);
    const double eps = 1e-8;
    const int maxn = 1e5 + 10;
    const int mod = 1e9 + 7;
    const int dr[] = {-1, 0, 1, 0};
    const int dc[] = {0, 1, 0, -1};
    const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
    int n, m;
    const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    inline bool is_in(int r, int c){
      return r >= 0 && r < n && c >= 0 && c < m;
    }
    
    int main(){
      int T;  cin >> T;
      for(int kase = 1; kase <= T; ++kase){
        double v1, v2, v3, a1, a2;
        cin >> v1 >> v2 >> v3 >> a1 >> a2;
        double d = v1 * v1 / (2.0*a1) + v2 * v2 / (2.0*a2);
        double ans = v3 * max(v1 / a1, v2 / a2);
        printf("Case %d: %.10f %.10f
    ", kase, d, ans);
      }
      return 0;
    }
    

      

  • 相关阅读:
    Cannot resolve org.springframework:spring-web:5.2.2.BUILD-SNAPSHOT
    阿里规范最新泰山版下载
    Eureka启动连接报错Connect Refused
    SpringCloud集成feign和swagger导致feign报NullPointException
    js select 默认回显判断
    js 相差年、月、日
    mysql导出PDM文件步骤
    eclipse 安装反编译工具
    判断 List map set 是否为空
    mysql 5.7 版本的安装
  • 原文地址:https://www.cnblogs.com/dwtfukgv/p/6872077.html
Copyright © 2020-2023  润新知