首页 > 其他 > 详细

NYOJ题目97兄弟郊游问题

时间:2016-09-21 13:00:10      阅读:226      评论:0      收藏:0      [点我收藏+]

技术分享

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

 

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

哥哥追上弟弟的时间:

技术分享

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

技术分享

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

 

 

AC代码:

 1 import java.util.Scanner;
 2 
 3 public class Main {
 4 
 5     public static void main(String[] args) {
 6         
 7         Scanner sc=new Scanner(System.in);
 8         
 9         int times=sc.nextInt();
10         while(times-->0){
11             int m=sc.nextInt();
12             int x=sc.nextInt();
13             int y=sc.nextInt();
14             int z=sc.nextInt();
15             
16             double ans=(x*m)*1.0/(y-x)*z;
17             System.out.printf("%.2f\n",ans);
18         }
19         
20     }
21     
22 }

 

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

NYOJ题目97兄弟郊游问题

原文:http://www.cnblogs.com/cc11001100/p/5892121.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!