首页 > ACM题库 > HDU-杭电 > HDU 3497-Star Gazer[解题报告]HOJ
2014
04-09

HDU 3497-Star Gazer[解题报告]HOJ

Star Gazer

问题描述 :

Sven Cal Payang is a Natural who was a member of the Phantom Pain Special Forces and piloted the GAT-X105E Strike Noir.
As is known, Sven was astronomy amateur when he was still a child. After the war between ZAFT and Earth Alliance, he decided to continue his childhood dream.
Sven’s new house is located at a peaceful town. What’s more, there is a lake in his garden. One day, he came up with a new idea on finding stars using interference phenomenon. He put a radio wave receiver h meter above the surface of a lake. When a radio star rising, it detects maxima successively due to interference of radio waves from the star, and its reflection waves from the water. The wavelength of the waves is λ centimeters. Sven wants to find stars as quickly as possible. Can you help him?
Watch The Movie

输入:

Several cases are given until the end of input. Each line contains h and λ separated by a space.

输出:

Several cases are given until the end of input. Each line contains h and λ separated by a space.

样例输入:

0.5 20.0
20.0 0.5

样例输出:

5.74
0.00
Hint

Notice: When light reflected from a medium having an index of refraction greater than that of the medium in which it is traveling, a 180°phase change (or λ/2 shift ) occurs.

 

/*
	说起这题真的会气死人的,物理到现在全忘了,什么叫干涉完全不知道,等于说这题根本没办法解
	看了解题报告才知道,悲剧!!看来做ACM什么都要学好啊,上回也有一个物理的要积分的题目
*/
#include <iostream>
#include <cstdio>
#include <cmath>
#define IP 3.1415926
using namespace std;
int main()
{
	double r, h;
	while( scanf("%lf %lf", &h, &r) != EOF)
	{
		double ans = asin(0.01 * r / (4 * h));
		printf("%0.2lf/n", 180 * ans / IP);
	}
}

 

 

参考:http://blog.csdn.net/huixisheng/article/details/5786209


  1. 3,求得所有的为的总和sum—->所有数的总和
    printf( "Not Possible" );—->printf("impossible");
    对吗?

  2. 思路二可以用一个长度为k的队列来实现,入队后判断下队尾元素的next指针是否为空,若为空,则出队指针即为所求。