Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit eb043fa

Browse files
Commit
1 parent a6623b1 commit eb043fa

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

‎Implimentation/Sequence Equation.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/python3
2+
3+
import math
4+
import os
5+
import random
6+
import re
7+
import sys
8+
9+
# Complete the permutationEquation function below.
10+
def permutationEquation(p):
11+
l=len(p)
12+
r=[]
13+
for i in range(0,l):
14+
a=0
15+
for j in range(0,l):
16+
if p[j]==(i+1):
17+
a=j+1
18+
break
19+
for j in p:
20+
if j==a:
21+
a=p.index(a)
22+
break
23+
r.append(a+1)
24+
return(r)
25+
26+
if __name__ == '__main__':
27+
fptr = open(os.environ['OUTPUT_PATH'], 'w')
28+
29+
n = int(input())
30+
31+
p = list(map(int, input().rstrip().split()))
32+
33+
result = permutationEquation(p)
34+
35+
fptr.write('\n'.join(map(str, result)))
36+
fptr.write('\n')
37+
38+
fptr.close()

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /