You are viewing a single comment's thread. Return to all comments →
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution {
static void Main(String[] args) { int n = Convert.ToInt32(Console.ReadLine()); //string[] arr_temp = Console.ReadLine().Split(' '); //int[] arr = Array.ConvertAll(arr_temp,Int32.Parse); decimal positiveNum = 0, negativeNum = 0, zeroNum = 0, temp = (decimal)1 / n; foreach (string ch in Console.ReadLine().Split(' ')) { Int16 num = Convert.ToInt16(ch); if (num > 0) { ++positiveNum; } else if (num < 0) { ++negativeNum; } else if (num == 0) { ++zeroNum; } } Console.WriteLine(Math.Round(positiveNum * temp, 6)); Console.WriteLine(Math.Round(negativeNum * temp, 6)); Console.WriteLine(Math.Round(zeroNum * temp, 6)); }
}
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
using System; using System.Collections.Generic; using System.IO; using System.Linq; class Solution {
}