結果
問題 | No.2937 Sigma Plus Problem |
ユーザー |
|
提出日時 | 2024-10-26 11:33:03 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 42 ms / 300 ms |
コード長 | 1,469 bytes |
コンパイル時間 | 539 ms |
コンパイル使用メモリ | 82,420 KB |
実行使用メモリ | 55,568 KB |
最終ジャッジ日時 | 2024-10-26 11:33:06 |
合計ジャッジ時間 | 2,605 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
# ライブラリと関数と便利変数 # ライブラリ 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() print((n * (n + 1)) // 2)