Codeforces 194B.Square
1 題目描述(題目連結)
2 題解
輸入是
n
n
n,那麼結果是:
l
c
m
(
4
∗
n
,
n
+
1
)
n
+
1
+
1
\cfrac{lcm(4*n, n+1)}{n+1} + 1
n+1lcm(4∗n,n+1)+1
即:
4
∗
n
g
c
d
(
4
∗
n
,
n
+
1
)
+
1
\cfrac{4*n}{gcd(4*n, n+1)} + 1
gcd(4∗n,n+1)4∗n+1
from math import gcd
n = int(input())
arr = input().split()
res = [4*int(i)//gcd(4*int(i), int(i) + 1) + 1 for i in arr]
for i in res:
print(i)
相關文章
- Codeforces
- CodeForces 1307
- 9.11 codeforces
- 【CodeForces訓練記錄】Codeforces Global Round 27
- codeforces Photo of The Sky
- Codeforces 專區
- codeforces 11/10
- CodeForces 1935A
- Codeforces Round 955
- Codeforces - Jzzhu and Numbers
- 【CodeForces訓練記錄】Codeforces Round 982 (Div. 2)
- 【CodeForces訓練記錄】Codeforces Round 986 (Div. 2)
- 【CodeForces訓練記錄】Codeforces Round 981 (Div. 3)
- 【CodeForces訓練記錄】Codeforces Round 984 (Div. 3)
- 【CodeForces訓練記錄】Codeforces Round 991 (Div. 3)
- 【CodeForces訓練記錄VP】Codeforces Round 933 (Div. 3)
- codeforces_1131_D
- codeforces_B. Barnicle
- Educational Codeforces Round 163
- CodeForces - 1363B
- Codeforces——231A Team
- A - Fence CodeForces - 1422A
- Codeforces 1969 A-F
- Codeforces 1847 A-F
- CodeForces - 765F
- codeforces ECR169
- Codeforces ICPC那場
- CodeForces - 702F
- CodeForces - 1982E
- CodeForces - 1485F
- CodeForces - 1984E
- Codeforces Global Round 26
- Codeforces Global Round 27
- Codeforces 983 A-E
- Codeforces Global Round 13
- Codeforces C. Colored Rooks 構造 (Codeforces Round #518 (Div. 2) )
- 【CodeForces訓練記錄】Educational Codeforces Round 171 (Rated for Div. 2)
- 【CodeForces訓練記錄】Codeforces Round 976 (Div. 2) and Divide By Zero 9.0IDE