Skip to content

Commit 8593e9d

Browse files
Solve AdHoc 334A in python
1 parent 2224391 commit 8593e9d

File tree

1 file changed

+24
-0
lines changed
  • problems_solutions/codeforces/AdHoc

1 file changed

+24
-0
lines changed

Diff for: problems_solutions/codeforces/AdHoc/334A.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
n = int(input())
2+
3+
sq = n ** 2
4+
summation = (sq * (sq + 1))//2
5+
goal = summation / n
6+
candidates = [i for i in range(1, sq + 1)]
7+
8+
pairs = []
9+
10+
for i in range(sq//2):
11+
pairs.append((candidates[i], candidates[sq - i - 1]))
12+
13+
counter = 0
14+
maximum = n/2
15+
16+
for el in pairs:
17+
if counter:
18+
print(' ', end='')
19+
print(el[0], el[1], end='')
20+
counter += 1
21+
22+
if(counter == maximum):
23+
counter = 0
24+
print('')

0 commit comments

Comments
 (0)