結果
| 問題 |
No.2937 Sigma Plus Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-26 11:31:39 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,528 bytes |
| コンパイル時間 | 331 ms |
| コンパイル使用メモリ | 82,320 KB |
| 実行使用メモリ | 55,972 KB |
| 最終ジャッジ日時 | 2024-10-26 11:31:42 |
| 合計ジャッジ時間 | 2,722 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 4 |
ソースコード
# ライブラリと関数と便利変数
# ライブラリ
from collections import deque, defaultdict, Counter
from math import pi
from itertools import permutations
import bisect
import sys
# cortedcontainersは使うときだけ wandbox非対応なので
# from sortedcontainers import SortedDict, SortedSet, SortedList
# 関数
def pow(x: int, n: int, t: int = 1):
# O(log N)
if t == 1:
ans = 1
while n:
if n % 2:
ans = ans * x
x = x * x
n >>= 1
return ans
ans = 1
while n:
if n % 2:
ans = (ans * x) % t
x = (x * x) % t
n >>= 1
return ans
def is_prime(n: int) -> bool:
# O(√N)
if n == 1:
return False
i = 2
s = n**0.5
while i < s:
if n % i == 0:
return False
i += 1
return True
def gcd(a, b):
while a > 0 and b > 0:
if a > b:
a = a % b
else:
b = b % a
return max(a, b)
def lcm(a, b):
return (a * b) // gcd(a, b)
# 標準入力系
def s():
return sys.stdin.readline().rstrip()
def sl():
return s().split()
def ii():
return int(s())
def il(add_num: int = 0):
return list(map(lambda i: int(i) + add_num, sl()))
# 便利変数
INF = 10**18
lowerlist = list("abcdefghijklmnopqrstuvwxyz")
upperlist = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
# コード
n = ii()
if n % 2 == 0:
print(int((n // 2) * (n + 1)))
else:
print(int((n / 2) * (n + 1)))