• hdu 3940


    #include<stdio.h>
    #include<math.h>
    #include<string.h>
    double first(double vx,double vy,double h) {
        return vx*(vy+sqrt(vy*vy+19.6*h))/9.8;
    }
    double nowh(double h,double vy,double t) {
        return h+vy*t-4.9*t*t;
    }
    int main() {
        double  k,h,vx,vy,v1,v2,v3,h1,h2,t;
        char s[30];
        while(scanf("%lf%s",&h,s)!=EOF) {
            if(strcmp(s,"Red")==0) {
                scanf("%lf%lf",&vx,&vy);
                printf("%.3f ",first(vx,vy,h));
                continue;
            }
                if(strcmp(s,"Yellow")==0) {
                scanf("%lf%lf%lf",&vx,&vy,&t);
              if(first(vx,vy,h)<vx*t) {
                 printf("%.3f ",first(vx,vy,h));
                 continue;
        }
            h1=nowh(h,vy,t);
            h2=vx*t;
            vy=vy-9.8*t;
            printf("%.3f ",h2+first(2*vx,2*vy,h1));
            continue;
                }
                if(strcmp(s,"Blue")==0){
                    scanf("%lf%lf%lf%lf%lf%lf",&vx,&vy,&t,&v1,&v2,&v3);
                    if(first(vx,vy,h)<vx*t) {
                    printf("%.3f ",first(vx,vy,h));
                    continue;
                    }
                     h1=nowh(h,vy,t);
                     h2=vx*t;
                     vy=vy-9.8*t;
        printf("%.3f %.3f %.3f ",h2+first(v1,vy,h1),h2+first(v2,vy,h1),h2+first(v3,vy,h1));
                }
        }
        return 0;
    }

    //一个博客地址帮助你理解http://blog.sina.com.cn/s/blog_c0519a300101dr2w.html

  • 相关阅读:
    互联网思维(1)
    互联网思维
    WLAN和WIFI的区别
    ping操作
    一篇关于正则表达式的小结
    javascript正则表达式
    为什么原型继承很重要 – SegmentFault
    JS面向对象基础讲解(工厂模式、构造函数模式、原型模式、混合模式、动态原型
    【转】前端开发文档规范
    我的第一篇博文
  • 原文地址:https://www.cnblogs.com/thefirstfeeling/p/4410999.html
Copyright © 2020-2023  润新知