아나그램 퀴즈 생각하기 매우 귀찮아서.. (CLAPISE가 뭘까영..)
코딩은 캐 발로 했음 -_-
아 이게 뭔 뻘짓이야 (..)
돌리는데 한 15분 걸렸나;;
네이버 안 썼으면 좀 빨리 됐을텐데 (먼 산)
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
namespace ConsoleApplication6
{
class Program
{
static void Permutation(string value, string stack)
{
if (value.Length == 0)
if (Try(stack))
Console.WriteLine("WAWA " + stack);
for (int i = 0; i < value.Length; ++i)
{
string firstChar = value[i].ToString();
string tail = value.Replace(firstChar, "");
Permutation(tail, stack + firstChar);
}
}
static bool Try(string q)
{
HttpWebResponse response = null;
try
{
string url = "http://endic.naver.com/search.nhn?query=" + q;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
response = (HttpWebResponse)request.GetResponse();
StreamReader responseReader = new StreamReader(response.GetResponseStream(), Encoding.Default);
string result = responseReader.ReadToEnd();
if (result.IndexOf("검색결과가 없습니다") < 0)
return true;
else
return false;
}
finally
{
response.Close();
}
}
static void Main(string[] args)
{
Permutation("CLAPISE", "");
}
}
}
CAPSELI
CAPELIS
LAPESIC
ACPELIS
APCELIS
PCIALES
PCSIALE
PLAICES
PLICAES
PACSELI
PACELIS
PALESIC
PIECALS
IPCESAL
IPSECAL
SCAPELI
SALEPIC
SPCIALE
SPACELI
SPICALE
SPICEAL
SPECIAL
SEPALIC
EPALICS
EPICALS
EPICSAL
ESPCIAL
뭐야 답이 너무 -_-...
아 이러고 놀아야 되나 (..)
코딩은 캐 발로 했음 -_-
아 이게 뭔 뻘짓이야 (..)
돌리는데 한 15분 걸렸나;;
네이버 안 썼으면 좀 빨리 됐을텐데 (먼 산)
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Net;
using System.IO;
namespace ConsoleApplication6
{
class Program
{
static void Permutation(string value, string stack)
{
if (value.Length == 0)
if (Try(stack))
Console.WriteLine("WAWA " + stack);
for (int i = 0; i < value.Length; ++i)
{
string firstChar = value[i].ToString();
string tail = value.Replace(firstChar, "");
Permutation(tail, stack + firstChar);
}
}
static bool Try(string q)
{
HttpWebResponse response = null;
try
{
string url = "http://endic.naver.com/search.nhn?query=" + q;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
response = (HttpWebResponse)request.GetResponse();
StreamReader responseReader = new StreamReader(response.GetResponseStream(), Encoding.Default);
string result = responseReader.ReadToEnd();
if (result.IndexOf("검색결과가 없습니다") < 0)
return true;
else
return false;
}
finally
{
response.Close();
}
}
static void Main(string[] args)
{
Permutation("CLAPISE", "");
}
}
}
CAPSELI
CAPELIS
LAPESIC
ACPELIS
APCELIS
PCIALES
PCSIALE
PLAICES
PLICAES
PACSELI
PACELIS
PALESIC
PIECALS
IPCESAL
IPSECAL
SCAPELI
SALEPIC
SPCIALE
SPACELI
SPICALE
SPICEAL
SPECIAL
SEPALIC
EPALICS
EPICALS
EPICSAL
ESPCIAL
뭐야 답이 너무 -_-...
아 이러고 놀아야 되나 (..)




덧글