python-algorithm
백준 9713 Sum of Odd Sequence
무적김두칠
2022. 12. 6. 15:50
https://www.acmicpc.net/problem/9713
9713번: Sum of Odd Sequence
First line of the input contains T, the number of test cases. Each test case contains a single integer N. N is between 1 and 100.
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
|
def sol(n):
answer = (n//2+1)**2
return answer
if __name__ == '__main__':
t = int(input())
for _ in range(t):
n = int(input())
print(sol(n))
|
cs |
홀수의 합 구하는 공식:
n^2
반응형