結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー parukiparuki
提出日時 2024-03-03 00:43:55
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 1,758 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 6,676 KB
実行使用メモリ 70,616 KB
最終ジャッジ日時 2024-03-03 00:44:17
合計ジャッジ時間 19,557 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
37,632 KB
testcase_01 AC 1,618 ms
68,468 KB
testcase_02 AC 1,608 ms
68,468 KB
testcase_03 AC 1,586 ms
68,468 KB
testcase_04 AC 1,619 ms
68,468 KB
testcase_05 AC 1,734 ms
70,616 KB
testcase_06 AC 1,758 ms
70,616 KB
testcase_07 AC 281 ms
48,708 KB
testcase_08 AC 277 ms
48,708 KB
testcase_09 AC 145 ms
44,636 KB
testcase_10 AC 159 ms
44,504 KB
testcase_11 AC 70 ms
37,760 KB
testcase_12 AC 70 ms
37,760 KB
testcase_13 AC 185 ms
39,268 KB
testcase_14 AC 188 ms
39,140 KB
testcase_15 AC 165 ms
39,012 KB
testcase_16 AC 177 ms
39,140 KB
testcase_17 AC 194 ms
39,396 KB
testcase_18 AC 193 ms
39,140 KB
testcase_19 AC 182 ms
39,268 KB
testcase_20 AC 211 ms
38,756 KB
testcase_21 AC 182 ms
39,268 KB
testcase_22 AC 194 ms
39,268 KB
testcase_23 AC 223 ms
38,884 KB
testcase_24 AC 214 ms
38,884 KB
testcase_25 AC 216 ms
38,884 KB
testcase_26 AC 216 ms
38,884 KB
testcase_27 AC 217 ms
38,884 KB
testcase_28 AC 217 ms
38,884 KB
testcase_29 AC 216 ms
38,884 KB
testcase_30 AC 215 ms
38,884 KB
testcase_31 AC 216 ms
38,884 KB
testcase_32 AC 215 ms
38,884 KB
testcase_33 AC 213 ms
38,884 KB
testcase_34 AC 1,610 ms
67,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

Main(require("fs").readFileSync("/dev/stdin", "utf8").split("\n"));

function Main(lines) {
    const T = parseInt(lines[0]);
    for(let i=0; i<T; ++i) {
        // NM = lines[i+1].split(" ").map((x)=>BigInt(x));
        const NM = lines[i+1].split(" ").map(BigInt);
        const M = NM[1];
        const N = NM[0];
        const ans = N%2n==0?
            ((N/2n)%M*((N+1n)%M))%M
            : N%M*((N+1n)/2n%M)%M;
        console.log(ans.toString());
    }
}
0