|
|
вернуться в форумWA task1263 I don’t understand what is the mistake here. Help pls string[] val = Console.ReadLine().Split(' '); double[] k = new double[10000]; for(int i = 0; i < Convert.ToInt32(val[1]); i++) { string s = Console.ReadLine(); k[Convert.ToInt32(s) - 1]++; } double swap = 0; for(int i = 0; i < k.Length-1; i++) { for(int j = i + 1; j < k.Length - i - 1; j++) { if (k[j+1] > k[j]) { swap = k[j+1]; k[j+1] = k[j]; k[j] = swap; } } } for (int i = 0; i < Convert.ToInt32(val[0]); i++) {
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:N2}", (100 * k[i]) / Convert.ToDouble(val[1]))+"%"); }
|
|
|