WOJ1413-Pinhole Imaging

When placing a board with a pinhole in the middle between an object and a screen, the reversed image of the object will
appear on the screen. That is the so-called pinhole imaging.



Assume that we have a candle and a screen. We know the distance A between the pinhole and the candle. We also know the
distance B between the pinhole and the screen. We want to know the height of the fire displayed on the screen when we
know the height H of the real fire.
You could assume that the pinhole is very tiny and the screen is large enough.

输入格式

The input consists of multiple test cases. The first line of input contains an integer T, which is the number of test cases.

Each test case is on a separated line, and it consists three integers: A, B, H), separated by ONE whitespace.

[Technical Specification] T is an integer, and T <= 10.
A, B, H are integers, and 1 <= A, B, H <= 1000,000.

输出格式

For each test case, print a single line contains the height of the fire displayed on the screen, rounded to two fractional
digits.

样例输入

2
1 1 1
2 1 2

样例输出

1.00
1.00

小孔成像,就是一个简单的算术题

#include<stdio.h>
int main() {
	int T;
	double A,B,H;
	scanf("%d",&T);
	while(T--) {
		scanf("%lf %lf %lf",&A,&B,&H);
		printf("%.2lf\n",H*B/A);
	}
	return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值