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
vl4d1m1r4's solution for 200: TrainRoute, written in Java, submitted on 09.05.2010 12:22:53
import java.util.Hashtable; import java.util.StringTokenizer; public class TrainRoute { public String findActualSchedule(String plannedSchedule, String updates) { StringTokenizer st=new StringTokenizer(plannedSchedule); String [] stations=new String[25]; String [] time=new String[25]; String [] update=new String[50]; String [] updatetime=new String[50]; int i=0; int n=0; int u=0; String rez=""; while(st.hasMoreTokens()){ stations[i]=st.nextToken(); time[i]=st.nextToken(); i++; } n=i; i=0; st=new StringTokenizer(updates); while(st.hasMoreTokens()){ update[i]=st.nextToken(); updatetime[i]=st.nextToken(); i++; } u=i; Hashtable<String, String> table=new Hashtable<String, String>(); for(i=0;i<n;i++){ table.put(stations[i],time[i]); } for(i=0;i<u;i++){ table.put(update[i], updatetime[i]); } for(i=0;i<table.size();i++){ rez+=stations[i]+" "+table.get(stations[i])+" "; } return rez.trim(); } }