标签:基础练习 时间 ring span public 字母 new int system
1 import java.util.Scanner; 2 3 public class Main{ 4 public static void main(String[] args) { 5 int v1,v2,t,s,l; 6 Scanner input = new Scanner(System.in); 7 v1 = input.nextInt(); 8 v2 = input.nextInt(); 9 t = input.nextInt(); 10 s = input.nextInt(); 11 l = input.nextInt(); 12 int tu = 0,gui = 0; 13 int s1 = 0; 14 int s2; 15 while(tu<l&&gui<l){ 16 if(tu-gui>=t){ 17 s2 = s; 18 while(s2--!=0&&gui<l){ 19 gui = gui +v2; 20 s1++; 21 } 22 continue; 23 } 24 tu = tu + v1; 25 gui = gui+v2; 26 s1++; 27 } 28 if(tu>=l&&gui>=l){ 29 System.out.println("D"); 30 }else if(tu>=l){ 31 System.out.println("R"); 32 }else { 33 System.out.println("T"); 34 } 35 System.out.println(s1); 36 37 } 38 39 }
标签:基础练习 时间 ring span public 字母 new int system
原文地址:http://www.cnblogs.com/lolybj/p/6496319.html