結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー parukiparuki
提出日時 2024-03-03 00:43:55
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 1,667 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 41 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 71,680 KB
最終ジャッジ日時 2024-04-29 16:12:46
合計ジャッジ時間 18,933 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
39,168 KB
testcase_01 AC 1,584 ms
69,532 KB
testcase_02 AC 1,508 ms
69,532 KB
testcase_03 AC 1,522 ms
69,276 KB
testcase_04 AC 1,515 ms
69,276 KB
testcase_05 AC 1,618 ms
71,680 KB
testcase_06 AC 1,667 ms
71,516 KB
testcase_07 AC 314 ms
50,488 KB
testcase_08 AC 313 ms
50,356 KB
testcase_09 AC 120 ms
45,312 KB
testcase_10 AC 121 ms
45,312 KB
testcase_11 AC 68 ms
39,168 KB
testcase_12 AC 68 ms
39,296 KB
testcase_13 AC 183 ms
40,328 KB
testcase_14 AC 184 ms
40,464 KB
testcase_15 AC 166 ms
40,208 KB
testcase_16 AC 175 ms
40,336 KB
testcase_17 AC 191 ms
40,840 KB
testcase_18 AC 175 ms
40,588 KB
testcase_19 AC 186 ms
40,840 KB
testcase_20 AC 212 ms
39,996 KB
testcase_21 AC 184 ms
40,716 KB
testcase_22 AC 186 ms
40,712 KB
testcase_23 AC 214 ms
40,424 KB
testcase_24 AC 214 ms
40,296 KB
testcase_25 AC 214 ms
40,296 KB
testcase_26 AC 213 ms
40,556 KB
testcase_27 AC 213 ms
40,168 KB
testcase_28 AC 212 ms
40,420 KB
testcase_29 AC 214 ms
40,292 KB
testcase_30 AC 213 ms
40,428 KB
testcase_31 AC 214 ms
40,424 KB
testcase_32 AC 213 ms
40,348 KB
testcase_33 AC 212 ms
40,420 KB
testcase_34 AC 1,543 ms
67,292 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