publicclassSum { publicstaticvoidMain() { var sr = new StreamReader(Console.OpenStandardInput()); var sw = new StreamWriter(Console.OpenStandardOutput()); var count = Convert.ToInt32(sr.ReadLine()); var sum = 0L; var list = newlong[count];
for (var i = 0; i < count; i++) list[i] = Convert.ToInt64(sr.ReadLine());
for (var i = 0; i < count; i++) for (var j = i + 1; j < count; j++) sum += (list[i] + list[j]) / (list[i] * list[j]); sw.WriteLine(sum); sw.Flush(); sr.Close(); sw.Close(); } }
publicclassSum { publicstaticvoidMain() { var sr = new StreamReader(Console.OpenStandardInput()); var sw = new StreamWriter(Console.OpenStandardOutput()); var count = Convert.ToInt32(sr.ReadLine()); var sum = 0L; var a = 0L; var b = 0L; for (var i = 0; i < count; i++) { var s = Convert.ToInt64(sr.ReadLine()); switch (s) { case1: a++; break; case2: b++; break; } }
sum = a * (a - 1) + a * (count - a) + (b * (b - 1) / 2); sw.WriteLine(sum); Console.ReadLine(); sw.Flush(); sr.Close(); sw.Close(); } }