uho #3894(2007/11/12 07:58 GMT) [ C# ] Rating0/0=0.00
LINQ版
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
static void NakamaHazure(params int[] a) { var x = from y in a group y by y into z orderby z.Count() ascending select new { count = z.Count(), value = z.Key }; if (a.Length == x.ElementAt(0).count) { Console.WriteLine(x.ElementAt(0).value ); } else if (x.Count() == 2 && x.ElementAt(0).count == 1 ) { Console.WriteLine(x.ElementAt(0).value + "," + x.ElementAt(1).value); } }
Rating0/0=0.00-0+
1 reply [ reply ]
uho #3896(2007/11/12 08:03 GMT) Rating0/0=0.00
あー、8行目は x.Count() == 1 で。。。
[ reply ]
uho
#3894()
[
C#
]
Rating0/0=0.00
Rating0/0=0.00-0+
1 reply [ reply ]