zoukankan      html  css  js  c++  java
  • hdu 5078 2014鞍山现场赛 水题

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

    现场最水的一道题 连排序都不用,由于说了ti<ti+1

    //#pragma comment(linker, "/STACK:102400000,102400000")
    #include <cstdio>
    #include <cstring>
    #include <algorithm>
    #include <string>
    #include <iostream>
    #include <iomanip>
    #include <cmath>
    #include <map>
    #include <set>
    #include <queue>
    using namespace std;
    
    #define ls(rt) rt*2
    #define rs(rt) rt*2+1
    #define ll long long
    #define ull unsigned long long
    #define rep(i,s,e) for(int i=s;i<e;i++)
    #define repe(i,s,e) for(int i=s;i<=e;i++)
    #define CL(a,b) memset(a,b,sizeof(a))
    #define IN(s) freopen(s,"r",stdin)
    #define OUT(s) freopen(s,"w",stdout)
    const ll ll_INF = ((ull)(-1))>>1;
    const double EPS = 1e-8;
    const double pi = acos(-1.0);
    const int INF = 100000000;
    
    const int MAXN = 1000+20;
    
    double t[MAXN],x[MAXN],y[MAXN];
    struct Node {
        double t,x,y;
    }a[MAXN];
    
    bool cmp(Node a, Node b){
        return a.t<b.t;
    }
    
    int main()
    {
        int ncase,n;
        scanf("%d",&ncase);
        while(ncase--)
        {
            scanf("%d",&n);
            double ans=0.0;
            for(int i=0;i<n;i++)
            {
                scanf("%lf%lf%lf",&a[i].t,&a[i].x,&a[i].y);
            }
            
            for(int i=0;i<n-1;i++)
                ans=max(ans,sqrt( (a[i].x-a[i+1].x)*(a[i].x-a[i+1].x)+(a[i].y-a[i+1].y)*(a[i].y-a[i+1].y) )/(a[i+1].t-a[i].t));
            printf("%.10lf
    ",ans);
        }
        return 0;
    }
    


  • 相关阅读:
    程序修炼之道——从小工到专家(3)
    组合
    子类重用父类的功能
    对象之间的交互
    属性查找与绑定方法
    类与对象的定义与使用
    hashlib模块subprocess模块
    configerparser模块
    shelve模块 xml模块
    sys模块 json pickle模块
  • 原文地址:https://www.cnblogs.com/claireyuancy/p/7096491.html
Copyright © 2011-2022 走看看