æé ã«ä¸¦ãã æ°å¤ããé£ç¶ããæ°å¤ãã¨ã«ã°ã«ã¼ãåãããããã°ã©ã ã§ãã using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { int[] xs = { 1, 2, 3, 6, 9, 10, 13, 14, 15, 16, 99, 100 }; var g = xs.Select((x, index) => new { x, index }) .GroupBy(e => e.x - e.index, e => e.x); foreach (var a in g) { Console.WriteLine(string.Join(", ", a)); } } } å®è¡çµæã§ãã 1, 2, 3 6 9, 10 13, 14, 15, 16 99
{{#tags}}- {{label}}
{{/tags}}