|
|
back to boardWhy Wrong Answer №6? using System; namespace Training { class Program { static void Main(string[] args) { string[] n = Console.ReadLine().Split(' '); int N = Convert.ToInt32(n[0]); int M = Convert.ToInt32(n[1]); double cnt = 1; int arr = 0; int[] ans = new int[M]; double[] vs = new double[N]; for (int i = 0; i < M; i++) ans[i] = Convert.ToInt32(Console.ReadLine()); Array.Sort(ans); Array.Resize(ref ans, ans.Length+1); Console.WriteLine(); for (int j = 0; j < M; j++) { if (ans[j] == ans[j + 1]) cnt++; else { double x = Math.Round(cnt / M * 100, 2); if ((int)x == x) Console.WriteLine(x + ".00%"); else Console.WriteLine(x + "%"); arr++; cnt = 1; } } if (arr < N) for (int j = 0; j < N - arr; j++) Console.WriteLine("0.00%"); } } } |
|
|