您的位置:首页 > 其它

NYOJ题目97兄弟郊游问题

2016-09-21 11:51 274 查看

---------------------------

 

这种问题就是列方程,然后求解就可以了。

哥哥追上弟弟的时间:

(弟弟先跑的路程/哥哥比弟弟快出来的速度)

(哥哥追上弟弟的时间*狗的速度)

 

 

AC代码:

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner sc=new Scanner(System.in);

int times=sc.nextInt();
while(times-->0){
int m=sc.nextInt();
int x=sc.nextInt();
int y=sc.nextInt();
int z=sc.nextInt();

double ans=(x*m)*1.0/(y-x)*z;
System.out.printf("%.2f\n",ans);
}

}

}

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=97

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: