Skip to content

Commit f32792b

Browse files
authored
Add files via upload
1 parent 84cb0ed commit f32792b

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

1074_Z.ipynb

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 37,
6+
"metadata": {},
7+
"outputs": [
8+
{
9+
"name": "stdout",
10+
"output_type": "stream",
11+
"text": [
12+
"2 3 1\n",
13+
"11\n"
14+
]
15+
}
16+
],
17+
"source": [
18+
"N, r, c = map(int, input().split())\n",
19+
"n = 4 ** N\n",
20+
"ans = 0\n",
21+
"for i in range(N):\n",
22+
" R = r//(2**(N-1))\n",
23+
" C = c//(2**(N-1))\n",
24+
" t = 2*R + C\n",
25+
" r -= 2**(N-1) * R\n",
26+
" c -= 2**(N-1) * C\n",
27+
"\n",
28+
" carry = 4 ** (N-1) * t\n",
29+
" n //= 4\n",
30+
" N -= 1\n",
31+
" ans += carry\n",
32+
"print(ans)"
33+
]
34+
},
35+
{
36+
"cell_type": "code",
37+
"execution_count": null,
38+
"metadata": {},
39+
"outputs": [],
40+
"source": []
41+
},
42+
{
43+
"cell_type": "code",
44+
"execution_count": null,
45+
"metadata": {},
46+
"outputs": [],
47+
"source": []
48+
}
49+
],
50+
"metadata": {
51+
"kernelspec": {
52+
"display_name": "Python 3",
53+
"language": "python",
54+
"name": "python3"
55+
},
56+
"language_info": {
57+
"codemirror_mode": {
58+
"name": "ipython",
59+
"version": 3
60+
},
61+
"file_extension": ".py",
62+
"mimetype": "text/x-python",
63+
"name": "python",
64+
"nbconvert_exporter": "python",
65+
"pygments_lexer": "ipython3",
66+
"version": "3.6.8"
67+
}
68+
},
69+
"nbformat": 4,
70+
"nbformat_minor": 2
71+
}

0 commit comments

Comments
 (0)