結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー paruki
提出日時 2024-03-03 00:43:55
言語 JavaScript
(node v23.5.0)
結果
AC  
実行時間 1,598 ms / 2,000 ms
コード長 462 bytes
コンパイル時間 160 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 71,548 KB
最終ジャッジ日時 2024-11-18 21:15:14
合計ジャッジ時間 20,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

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