문제번호: 35143
문제명: 2026
문제링크: https://www.acmicpc.net/problem/35143
문제내용과 예제 입/출력은 위 문제 링크에서 확인해 주시기 바랍니다.
public static void Main()
{
using var sr = new StreamReader(Console.OpenStandardInput());
using var sw = new StreamWriter(Console.OpenStandardOutput());
int N = int.Parse(sr.ReadLine());
BigInteger tarrgetmin = BigInteger.Pow(10, N - 1);
BigInteger kStart = BigInteger.Pow(10, (N - 1) / 2);
BigInteger k = kStart;
while (true)
{
if (IsFillendForm(k))
{
BigInteger ksquared = k * k;
if ((ksquared >= tarrgetmin))
{
if (IsFillendForm(ksquared) && IsFillendForm(ksquared * ksquared))
{
sw.WriteLine(1905 + ksquared);
break;
}
}
}
k++;
}
bool IsFillendForm(BigInteger num)
{
string strNum = num.ToString();
int length = strNum.Length;
for (int i = 0; i < length / 2; i++)
{
if (strNum[i] != strNum[length - 1 - i])
return false;
}
return true;
}
sr.Close();
sw.Close();
}'알고리즘 풀이' 카테고리의 다른 글
| [C#] 백준 2018번 문제풀이 (0) | 2026.01.28 |
|---|---|
| [C#] 백준 10867번 문제풀이 (0) | 2026.01.27 |
| [C#] 백준 1417번 문제풀이 (0) | 2026.01.25 |
| [C#] 백준 11725번 문제풀이 (0) | 2026.01.24 |
| [C#] 백준 11053번 문제풀이 (0) | 2026.01.23 |