알고리즘/백준 BOJ
[BOJ C#] 1181 단어 정렬
왹져박사
2023. 1. 12. 23:49
case #1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1181
{
class App
{
//생성자
public App()
{
string[] arr = {
"but", "i", "wont", "hesitate", "no", "more", "no", "it", "cannot", "wait", "im", "your"
};
//여기부터 작성하세요
for(int i = 1; i < arr.Length; i++)
{
var strs = from str in arr
where str.Length==i
orderby str ascending
select str;
foreach (string str in strs)
{
Console.WriteLine(str);
}
}
//출력
//i
//im
//it
//no
//but
//more
//wait
//wont
//yours
//cannot
//hesitate
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _1181
{
class Program
{
static void Main(string[] args)
{
new App();
}
}
}
아직 쿼리문이 익숙하지 않아 다시 공부하며 작성하였다!