結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー StanMarshStanMarsh
提出日時 2024-02-23 22:12:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,087 ms / 2,000 ms
コード長 1,360 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 113,664 KB
最終ジャッジ日時 2024-02-23 22:12:54
合計ジャッジ時間 10,851 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,460 KB
testcase_01 AC 687 ms
82,268 KB
testcase_02 AC 614 ms
82,288 KB
testcase_03 AC 649 ms
82,316 KB
testcase_04 AC 668 ms
82,268 KB
testcase_05 AC 1,029 ms
83,156 KB
testcase_06 AC 1,087 ms
83,164 KB
testcase_07 AC 140 ms
77,036 KB
testcase_08 AC 140 ms
77,040 KB
testcase_09 AC 97 ms
77,036 KB
testcase_10 AC 98 ms
77,036 KB
testcase_11 AC 47 ms
64,436 KB
testcase_12 AC 45 ms
64,436 KB
testcase_13 AC 132 ms
100,928 KB
testcase_14 AC 140 ms
99,040 KB
testcase_15 AC 131 ms
104,796 KB
testcase_16 AC 132 ms
96,832 KB
testcase_17 AC 141 ms
103,900 KB
testcase_18 AC 132 ms
97,792 KB
testcase_19 AC 136 ms
99,376 KB
testcase_20 AC 139 ms
113,436 KB
testcase_21 AC 131 ms
102,132 KB
testcase_22 AC 134 ms
102,676 KB
testcase_23 AC 129 ms
113,584 KB
testcase_24 AC 128 ms
113,596 KB
testcase_25 AC 140 ms
113,584 KB
testcase_26 AC 128 ms
113,584 KB
testcase_27 AC 129 ms
113,664 KB
testcase_28 AC 127 ms
113,664 KB
testcase_29 AC 128 ms
113,584 KB
testcase_30 AC 128 ms
113,584 KB
testcase_31 AC 129 ms
113,584 KB
testcase_32 AC 127 ms
113,664 KB
testcase_33 AC 126 ms
113,584 KB
testcase_34 AC 604 ms
82,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0