Google 2014校招测试赛 Problem B

简介:

Problem B. Captain Hammer

Problem

The Hamjet is a true marvel of aircraft engineering. It is a jet airplane with a single engine so powerful that it burns all of its fuel instantly during takeoff. The Hamjet doesn't have any wings because who needs them when the fuselage is made of a special Wonderflonium isotope that makes it impervious to harm.

Piloting the Hamjet is a not a job for your typical, meek-bodied superhero. That's why the Hamjet belongs to Captain Hammer, who is himself impervious to harm. The G-forces that the pilot endures when taking a trip in the Hamjet are legen-dary.

The Hamjet takes off at an angle of θ degrees up and a speed of V meters per second. Vis a fixed value that is determined by the awesome power of the Hamjet engine and the capacity of its fuel tank. The destination is D meters away. Your job is to program the Hamjet's computer to calculate θ given V and D.

Fortunately, the Hamjet's Wondeflonium hull is impervious to air friction. Even more fortunately, the Hamjet doesn't fly too far or too high, so you can assume that the Earth is flat, and that the acceleration due to gravity is a constant 9.8 m/s2 down.

Input

The first line of the input gives the number of test cases, T. T lines follow. Each line will contain two positive integers -- V and D.

Output

For each test case, output one line containing "Case #x: θ", where x is the case number (starting from 1) and θ is in degrees up from the the horizontal. If there are several possible answers, output the smallest positive one.

An answer will be considered correct if it is within 10-6 of the exact answer, in absolute or relative error. See the FAQ for an explanation of what that means, and what formats of floating-point numbers we accept.

Limits

1 ≤ T ≤ 4500; 1 ≤ V ≤ 300; 1 ≤ D ≤ 10000; It is guaranteed that each test case will be solvable.

Sample


Input 

3
98 980
98 490
299 1234

Output 

Case #1: 45.0000000
Case #2: 15.0000000
Case #3: 3.8870928


解法:抛物线已知重力,初速度和距离,求角度。算算公式就行,在精度的问题上碰了钉子。同样的公式用Python和Java得出的结果差0.0000001。重算公式,单步调试,最后还是无法解决。最后直接提交竟然通过了。幸亏没超过要求的精度范围。关键代码如下:


void run() {
    double g = 9.8;
    int COUNT = sc.nextInt();
    for (int c = 0; c < COUNT; c++) {
        double v = sc.nextInt();
        double d = sc.nextInt();
        double x = 0.25 - (d * d * g * g) / (4.0 * v * v * v * v);
        if(x<0&&x>-0.0000000001)
            x = 0;
        x = Math.sqrt(0.5 - Math.sqrt(x));
        double sin = Math.asin(x) * 180 / Math.PI;
        System.out.println(String.format("Case #%d: %.8f", c + 1, sin));
    }
}


目录
相关文章
|
1天前
|
计算机视觉
Google Earth Engine(GEE)——使用MODIS数据单点测试SG滤波和harmonics method 滤波的差异分析
Google Earth Engine(GEE)——使用MODIS数据单点测试SG滤波和harmonics method 滤波的差异分析
53 0
|
机器学习/深度学习 数据采集 人工智能
好饭不怕晚,Google基于人工智能AI大语言对话模型Bard测试和API调用(Python3.10)
谷歌(Google)作为开源过著名深度学习框架Tensorflow的超级大厂,是人工智能领域一股不可忽视的中坚力量,旗下新产品Bard已经公布测试了一段时间,毁誉参半,很多人把Google的Bard和OpenAI的ChatGPT进行对比,Google Bard在ChatGPT面前似乎有些技不如人。 事实上,Google Bard并非对标ChatGPT的产品,Bard是基于LaMDA模型对话而进行构建的,Bard旨在构建一个对话式的AI系统,使其能够更好地理解人类语言,并且具备进行多轮对话的能力。而GPT的目标是生成自然语言文本。
好饭不怕晚,Google基于人工智能AI大语言对话模型Bard测试和API调用(Python3.10)
流量如何才能变现?实际测试谷歌广告联盟(Google Adsense)的广告效果以及如何优化相关代码
2010年,谷歌正式退出中国市场,无数人扼腕叹息,如今十年过去了,谷歌还有两条重要的业务线并没有完全退出,一个是页面统计业务(Google Analytics),另外一个则是谷歌广告联盟(Google Adsense),说起广告联盟,玩儿过网站的朋友应该并不陌生,对于中小型站长、博主来说,要想通过网站的流量取得一些收入,除了和一些线下线上厂商谈包月广告位,更多的可能就是投放广告联盟广告了。但随着网络广告的不断发展,广告形式有了很大的变化,出现了CPC、CPS、CPA、CPV等众多广告类型。
流量如何才能变现?实际测试谷歌广告联盟(Google Adsense)的广告效果以及如何优化相关代码
【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 内部测试链接 | 安装 Google Play 中带 扩展文件 的 APK 安装包 | 验证下载的扩展文件 )(二)
【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 内部测试链接 | 安装 Google Play 中带 扩展文件 的 APK 安装包 | 验证下载的扩展文件 )(二)
139 0
【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 内部测试链接 | 安装 Google Play 中带 扩展文件 的 APK 安装包 | 验证下载的扩展文件 )(二)
【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 内部测试链接 | 安装 Google Play 中带 扩展文件 的 APK 安装包 | 验证下载的扩展文件 )(一)
【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 内部测试链接 | 安装 Google Play 中带 扩展文件 的 APK 安装包 | 验证下载的扩展文件 )(一)
270 0
【Google Play】APK 扩展包 ( 2021年09月02日最新处理方案 | 内部测试链接 | 安装 Google Play 中带 扩展文件 的 APK 安装包 | 验证下载的扩展文件 )(一)
【Google Play】Google Play 开放式测试 ( 简介 | 发布开放式测试版本 )(二)
【Google Play】Google Play 开放式测试 ( 简介 | 发布开放式测试版本 )(二)
244 0
【Google Play】Google Play 开放式测试 ( 简介 | 发布开放式测试版本 )(二)
【Google Play】Google Play 开放式测试 ( 简介 | 发布开放式测试版本 )(一)
【Google Play】Google Play 开放式测试 ( 简介 | 发布开放式测试版本 )(一)
518 0
【Google Play】Google Play 开放式测试 ( 简介 | 发布开放式测试版本 )(一)
|
1天前
|
网络协议 安全 测试技术
性能工具之emqtt-bench BenchMark 测试示例
【4月更文挑战第19天】在前面两篇文章中介绍了emqtt-bench工具和MQTT的入门压测,本文示例 emqtt_bench 对 MQTT Broker 做 Beachmark 测试,让大家对 MQTT消息中间 BenchMark 测试有个整体了解,方便平常在压测工作查阅。
126 7
性能工具之emqtt-bench BenchMark 测试示例
|
1天前
|
机器学习/深度学习 数据采集 人工智能
【专栏】AI在软件测试中的应用,如自动执行测试用例、识别缺陷和优化测试设计
【4月更文挑战第27天】本文探讨了AI在软件测试中的应用,如自动执行测试用例、识别缺陷和优化测试设计。AI辅助工具利用机器学习、自然语言处理和图像识别提高效率,但面临数据质量、模型解释性、维护更新及安全性挑战。未来,AI将更注重用户体验,提升透明度,并在保护隐私的同时,通过联邦学习等技术共享知识。AI在软件测试领域的前景广阔,但需解决现有挑战。
|
1天前
|
测试技术
如何管理测试用例?测试用例有什么管理工具?YesDev
该文档介绍了测试用例和测试用例库的管理。测试用例是描述软件测试方案的详细步骤,包括测试目标、环境、输入、步骤和预期结果。测试用例库用于组织和管理这些用例,强调简洁性、完整性和可维护性。管理者可以创建、删除、重命名用例库,搜索和管理用例,以及通过层级目录结构来组织用例。此外,还支持通过Excel导入和导出测试用例,以及使用脑图查看用例关系。后台管理允许配置全局别名,如用例状态、优先级和执行结果。

热门文章

最新文章