Register
|
Login
Home
News
Competitions
Practice
How to
Rankings
Calendar
Arena
CodeFu 2010
CodeFu'10 Highlights
Jazoon'10 Highlights
Schedule
Rules
Prizes
Results
Competitions
»
Main CodeFu Competitons
»
CodeFu 2010
»
Results
CodeFu 2010 Results
Final Round Results
stpanov's solution for 200: TrainRoute, written in Java, submitted on 09.05.2010 11:36:53
public class TrainRoute { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(new TrainRoute().findActualSchedule("A 09:00 B 10:03 C 11:07 D 12:13 E 14:20", "C 11:09 C 11:08 A 09:01")); } public String findActualSchedule(String plannedSchedule, String updates) { String result = ""; String temp1[] = plannedSchedule.split(" "); String temp2[] = updates.split(" "); String arrres[] = new String[temp1.length]; for (int i=0;i<temp1.length;i+=2) { for (int j=0;j<temp2.length;j+=2) if(temp1[i].compareTo(temp2[j])==0) temp1[i+1] = temp2[j+1]; } result = temp1[0]; for (int i=1;i<temp1.length;i++) result+= " " + temp1[i]; return result; } }