Skip to content

Commit

Permalink
Z
Browse files Browse the repository at this point in the history
  • Loading branch information
log2hong committed Jan 11, 2022
1 parent 4683d86 commit 2665c43
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions 1074.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <iostream>
using namespace std;

int main(){
int n, r, c;
cin >> n >> r >> c;

int ans = 0;
while(n){
int s = 1 << (n - 1);
int f;
if(r < s && c < s) f = 0;
else if(r < s && c >= s) f = 1;
else if(r >= s && c < s) f = 2;
else f = 3;

r %= s;
c %= s;
ans += s * s * f;
n--;
}
cout << ans << endl;
return 0;
}

0 comments on commit 2665c43

Please sign in to comment.