using System; using System.Collections.Generic; using System.Text; using System.Linq; class Program { public void Proc() { Reader.IsDebug = false; string[] inpt = Reader.ReadLine().Split(' '); this.StartX = int.Parse(inpt[0]); this.StartY = int.Parse(inpt[1]); double nimotsuTotal = 0; int cnt = int.Parse(Reader.ReadLine()); this.TargetList.Add(new Haitatsusaki(StartX, StartY, 0)); for(int i=0; i> dic = new Dictionary>(); public double GetAns(int point, int target, double nimotsu) { if(!dic.ContainsKey(point)) { dic.Add(point, new Dictionary()); } if(dic[point].ContainsKey(target)) { return dic[point][target]; } bool isTargetLast = false; int idx = 0; for(int i=0; i= 0) { ans = Math.Min(ans, ret + tmp); } } } dic[point].Add(target, ans); return ans; } private double GetDeliverCost(int fromPos, int toPos, double nimotsu) { int x1 = this.TargetList[fromPos].X; int y1 = this.TargetList[fromPos].Y; int x2 = this.TargetList[toPos].X; int y2 = this.TargetList[toPos].Y; double ans = GetMoveCost(x1, y1, x2, y2, nimotsu); ans += this.TargetList[toPos].Nimotsu; return ans; } private double GetMoveCost(int x1, int y1, int x2, int y2, double nimotsu) { double ans = (Math.Abs(x1-x2) + Math.Abs(y1-y2)) * ((nimotsu + 100) / 120d); return ans; } private List TargetList = new List(); public int StartX; public int StartY; public class Haitatsusaki { public int X; public int Y; public double Nimotsu; public Haitatsusaki(int x, int y, double nimotsu) { this.X = x; this.Y = y; this.Nimotsu = nimotsu; } } public class Reader { public static bool IsDebug = true; private static String PlainInput = @" 10 10 1 10 10 1.2 "; private static System.IO.StringReader Sr = null; public static string ReadLine() { if (IsDebug) { if (Sr == null) { Sr = new System.IO.StringReader(PlainInput.Trim()); } return Sr.ReadLine(); } else { return Console.ReadLine(); } } public static int[] GetInt(char delimiter = ' ', bool trim = false) { string inptStr = ReadLine(); if (trim) { inptStr = inptStr.Trim(); } string[] inpt = inptStr.Split(delimiter); int[] ret = new int[inpt.Length]; for (int i = 0; i < inpt.Length; i++) { ret[i] = int.Parse(inpt[i]); } return ret; } } static void Main() { Program prg = new Program(); prg.Proc(); } }