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;
}


全部评论

相关推荐

不愿透露姓名的神秘牛友
07-07 13:35
虽然不怎么光彩,经过这件事,可能我真的要去认同“面试八股文早该淘汰!不会用AI作弊的程序员=新时代文盲!”这句话了
HellowordX:Ai的出现是解放劳动力的,不是用来破坏公平竞争环境的,这样下去,轻则取消所有线上面试,严重了会影响整个行业对所有人产生影响,企业会拉高入职考核各种离谱考核会层出不穷
你找工作的时候用AI吗?
点赞 评论 收藏
分享
牛客38347925...:9,2学生暑期实习失利开始投小厂,给这群人整自信了
点赞 评论 收藏
分享
湫湫湫不会java:先投着吧,大概率找不到实习,没实习的时候再加个项目,然后把个人评价和荣誉奖项删了,赶紧成为八股战神吧,没实习没学历,秋招机会估计不多,把握机会。或者说秋招时间去冲实习,春招冲offer,但是压力会比较大
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务