Baekjoon #1074

Baekjoon #1074

1개의 풀이 · C++

문제 원문 보기 ↗

SOLUTION INFO

C++ · main.cpp

main.cpp
#include<bits/stdc++.h>

using namespace std;

int solve(int y, int x, int s) {
    if(s == 2) return 2 * y + x;
    s >>= 1;
    int ny = y / s, nx = x / s;
    int nxt = ny * 2 + nx;
    return s * s * nxt + solve(y - ny * s, x - nx * s, s);
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    int N, R, C; cin >> N >> R >> C;
    cout << solve(R, C, 1 << N);

    return 0;
}

SOLUTION DESCRIPTION

풀이 설명

등록된 풀이 설명이 없습니다.