|
|
back to boardWA7? C# using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _1413 { class Program { static void Main(string[] args) { System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; string[] temp = Console.ReadLine().Split('0'); string l = temp[0]; decimal k = 0,x=0,y=0; decimal sqrt =Convert.ToDecimal( Math.Sqrt(2))/2; for (int i = 1; i < 10; i++) { k = l.Split(new string[]{ i.ToString() }, 1000000000, StringSplitOptions.None).Length - 1; if (i == 1){ x -= k * sqrt;y-=k*sqrt;} if (i == 2) y -= k; if (i == 3) { x += k * sqrt; y -= k * sqrt; } if (i == 4) x -= k; if (i == 6) x += k; if (i == 7) { x -= k * sqrt; y += k * sqrt; } if (i == 8) y += k; if (i == 9) { x += k * sqrt; y += k * sqrt; } } Console.WriteLine("{0:F10} {1:F10}", x, y); } } } |
|
|