[C#] 백준 2908번 : 상수
using System;
class Program
{
static void Main()
{
string[] arr = Console.ReadLine().Split(" ");
string a = arr[0];
string b = arr[1];
string temp = "";
int[] num = new int[3];
for (int i = 2; i >= 0; i--)
{
if (a[i] < b[i])
{
temp = b;
break;
} else if (a[i] > b[i])
{
temp = a;
break;
}
}
if (temp == "")
{
temp = a;
}
int n = 0;
int t = 2;
while (t >= 0)
{
num[n] = temp[t] - '0';
n++;
t--;
}
for (int z = 0; z < num.Length; z++)
{
Console.Write(num[z]);
}
}
}
반응형
'백준 > C#' 카테고리의 다른 글
[C#] 백준 11718번 : 그대로 출력하기 (0) | 2025.02.06 |
---|---|
[C#] 백준 5622번 : 다이얼 (0) | 2025.02.06 |
[C#] 백준 1152번 : 단어의 개수 (1) | 2025.02.05 |
[C#] 백준 2675번 : 문자열 반복 (0) | 2025.02.05 |
[C#] 백준 10809번 : 알파벳 찾기 (0) | 2025.02.05 |