結果
| 問題 |
No.2649 [Cherry 6th Tune C] Anthem Flower
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-23 22:12:22 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 958 ms / 2,000 ms |
| コード長 | 1,360 bytes |
| コンパイル時間 | 241 ms |
| コンパイル使用メモリ | 82,016 KB |
| 実行使用メモリ | 114,808 KB |
| 最終ジャッジ日時 | 2024-09-29 06:56:01 |
| 合計ジャッジ時間 | 11,052 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 35 |
ソースコード
import sys
inf = float("inf")
input = lambda: sys.stdin.readline().rstrip("\r\n")
print = lambda *args, end="\n", sep=" ": sys.stdout.write(
sep.join(map(str, args)) + end
)
def II():
return int(input())
def MII(b=0):
return map(lambda x: int(x) - b, input().split())
def LII(b=0):
return list(MII(b))
class Decimal:
def __init__(self, num_str):
self.digits = [int(digit) for digit in num_str[::-1]]
def __add__(self, other):
result = []
carry = 0
max_len = max(len(self.digits), len(other.digits))
for i in range(max_len):
a = self.digits[i] if i < len(self.digits) else 0
b = other.digits[i] if i < len(other.digits) else 0
temp = a + b + carry
result.append(temp % 10)
carry = temp // 10
if carry:
result.append(carry)
return Decimal("".join(map(str, result[::-1])))
def __mod__(self, n):
remainder = 0
for digit in self.digits[::-1]:
remainder = (remainder * 10 + digit) % n
return remainder
num1 = Decimal("123")
num2 = Decimal("456")
sum_result = num1 + num2
mod_result = num1 % 7
for _ in range(II()):
x, m = input().split()
m = int(m)
x = Decimal(x)
y = x + Decimal("1")
m *= 2
print(((x % m) * (y % m) % m) // 2)