Difference between revisions of "CSharp: Seleção com ordenação de linhas"

From AdonaiMedrado.Pro.Br
Jump to: navigation, search
(New page: <code lang="csharp"> using System; using System.Collections.Generic; using System.Linq; namespace ExemploLinq { public class SelecaoComOrdenacaoDaString { public static void Executar(...)
 
(No difference)

Latest revision as of 17:47, 26 May 2009

using System;
using System.Collections.Generic;
using System.Linq;
 
namespace ExemploLinq
{
	public class SelecaoComOrdenacaoDaString
	{
		public static void Executar()
		{
			int k = int.Parse(Console.ReadLine());
			int n = int.Parse(Console.ReadLine());
			List<string> l = new List<string>();
			for(int i=0;i<n;i++)
				l.Add(Console.ReadLine());
 
			foreach(string s in l.Where(x=>x.Length>=k).OrderBy(x=>x))
				Console.WriteLine(s);
		}
	}
}