解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int v1=scanner.nextInt();
int v2=scanner.nextInt();
int t=scanner.nextInt();
int s=scanner.nextInt();
int l=scanner.nextInt();
int m=0;
int n=0;
int time=0;
int count=0;
while(m<l&&n<l) {
time++;
n+=v2;
if(count>0) {
count--;
continue;
}
m+=v1;
if(m-n>=t)
count=s;
}
if(m>n)
System.out.print("R"+"\n"+time);
else if(m<n)
System.out.print("T"+"\n"+time);
else
System.out.print("D"+"\n"+time);
}
}
0.0分
0 人评分
【数组的距离】 (C语言代码)浏览:728 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:885 |
字符串的输入输出处理 (C语言代码)浏览:924 |
【亲和数】 (C语言代码)浏览:501 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:459 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:543 |
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:608 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:579 |
C语言训练-排序问题<1> (C语言代码)浏览:355 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:1220 |