백준/1000 ~
[백준 / C#] 1074 : Z
무오_
2023. 6. 26. 18:25
internal class Program
{
static int n, r, c, result = 0;
static void Solution(int cnt)
{
while(n >0)
{
n--;
int pow = (int)Math.Pow(2, n);
if (r < pow && c < pow)
{
result += pow * pow * 0;
}
else if (r < pow && c >= pow)
{
result += pow * pow * 1;
c -= pow;
}
else if (r >= pow && c < pow)
{
result += pow * pow * 2;
r -= pow;
}
else
{
result += pow * pow * 3;
c -= pow;
r -= pow;
}
}
}
static void Input()
{
var input = Console.ReadLine().Split();
n = int.Parse(input[0]);
r = int.Parse(input[1]);
c = int.Parse(input[2]);
}
static void Output()
{
Console.WriteLine(result);
}
static void Solve()
{
Input();
Solution(n);
Output();
}
static void Main(string[] args)
{
Solve();
}
}