|
|
вернуться в форумWA on test 1. I use C#, pls help Послано Timur 16 окт 2008 01:29 namespace Ogorod { using System; class Program { static void Main() { string[] s = Console.ReadLine().Split(' '); double a = double.Parse(s[0]); double r = double.Parse(s[1]); double kozel=0;
if ( 2*r <= a ) kozel = Math.PI * r * r; if (2 * a * a <= 4 * r * r) kozel = a * a; if((2*r > a) && (2 * a * a > 4 * r * r)) { double sektor = r * r * Math.Acos((a * a) / (2 * (r * r)) - 1) / 2; double segment = sektor - (a / 2) * Math.Sqrt(r * r - (a * a / 4)); kozel = Math.PI * r * r - 4 * segment; } Console.WriteLine("{0:F3}",kozel); } } } Re: WA on test 1. I use C#, pls help Instead of Console.WriteLine("{0:F3}",kozel); you should use Console.WriteLine(kozel.ToString("F3").Replace(',', '.')); or set locale to en-US. Edited by author 16.10.2008 04:28 Re: WA on test 1. I use C#, pls help Break on a first test: 66.xxx instead of 95.xxx Locale en-US is default in Timus Checking System (RTFM). |
|
|