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 Mafia
- codeforces Winner
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)
- 【CodeForces訓練記錄】Codeforces Global Round 27
- codeforces Educational Codeforces Round 33 (Rated for Div. 2)B
- codeforces Photo of The Sky
- Codeforces - Jzzhu and Numbers
- codeforces #442 B
- Codeforces Sereja and Array
- Codeforces Round #174
- Codeforces Round #170
- Codeforces Round 955
- Codeforces 專區
- 9.11 codeforces
- codeforces 11/10
- 【CodeForces訓練記錄】Codeforces Round 981 (Div. 3)
- 【CodeForces訓練記錄】Codeforces Round 982 (Div. 2)
- 【CodeForces訓練記錄】Codeforces Round 984 (Div. 3)
- 【CodeForces訓練記錄】Codeforces Round 986 (Div. 2)
- Codeforces Global Round 13
- codeforces_B. Barnicle
- CodeForces 1307
- CodeForces - 1363B
- Educational Codeforces Round 32
- Codeforces Beta Round #32
- Codeforces Beta Round #23
- Codeforces Round #180
- Codeforces Global Round 26
- Codeforces Global Round 27
- CodeForces - 765F
- Codeforces 983 A-E
- 【CodeForces訓練記錄VP】Codeforces Round 933 (Div. 3)
- 【CodeForces訓練記錄】Educational Codeforces Round 171 (Rated for Div. 2)
- codeforces比賽日記
- Codeforces Educational Round#98 A
- codeforces #313(div 2)
- Educational Codeforces Round 1 Tutorial