Go to diff to previous submission
import java.io.BufferedReader; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.LinkedList; import java.util.StringTokenizer; /** * * @author cteam022 */ public class Ants { /** * @param args the command line arguments */ Ants g = new Ants(); while(true){g.uloha();} } int[] pozic = new int[A]; boolean[] smery = new boolean[L+5]; int pravy = 0; int levy = 0; int cas2 = -1; int mravenec2 = -1; for(int i = 0; i<A; i++){ boolean smer = (s.equals("R")); pozic[i] = pozice; //smery[i] = smer; if(smer){ pravy++; }else{ levy++; } if(pozice < cas1 && smer ) { cas1 = pozice; mravenec1 = i; } if(pozice > cas2 && smer==false ) { cas2 = pozice; mravenec2 = i; } } cas1 = -1; else cas1 = L - cas1; if(cas1 == cas2){ System.out.println("The last ant will fall down in " + cas1 + " seconds - started at " + pozic[levy-1] + " and "+pozic[levy]+"."); }else{ if(cas1 > cas2){ System.out.println("The last ant will fall down in " + cas1 + " seconds - started at " +pozic[levy]+"."); }else{ System.out.println("The last ant will fall down in " + cas2 + " seconds - started at " +pozic[levy-1]+"."); } } } }
--- c4.s1102.cteam022.ants.java.0.Ants.java +++ c4.s1113.cteam022.ants.java.0.Ants.java @@ -85,11 +85,11 @@ if(cas1 == cas2){ - System.out.println("The last ant will fall down in " + cas1 + " seconds - started at " + pozic[levy-1] + " and "+pozic[levy]); + System.out.println("The last ant will fall down in " + cas1 + " seconds - started at " + pozic[levy-1] + " and "+pozic[levy]+"."); }else{ if(cas1 > cas2){ - System.out.println("The last ant will fall down in " + cas1 + " seconds - started at " +pozic[levy]); + System.out.println("The last ant will fall down in " + cas1 + " seconds - started at " +pozic[levy]+"."); }else{ - System.out.println("The last ant will fall down in " + cas2 + " seconds - started at " +pozic[levy-1]); + System.out.println("The last ant will fall down in " + cas2 + " seconds - started at " +pozic[levy-1]+"."); }