結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー ks2mks2m
提出日時 2024-02-23 21:38:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 972 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 2,793 ms
コンパイル使用メモリ 74,500 KB
実行使用メモリ 72,992 KB
最終ジャッジ日時 2024-02-23 21:39:16
合計ジャッジ時間 13,865 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
54,104 KB
testcase_01 AC 690 ms
68,620 KB
testcase_02 AC 654 ms
68,536 KB
testcase_03 AC 710 ms
68,424 KB
testcase_04 AC 722 ms
72,356 KB
testcase_05 AC 922 ms
72,992 KB
testcase_06 AC 972 ms
72,868 KB
testcase_07 AC 207 ms
59,376 KB
testcase_08 AC 208 ms
59,248 KB
testcase_09 AC 143 ms
56,808 KB
testcase_10 AC 141 ms
56,668 KB
testcase_11 AC 61 ms
54,116 KB
testcase_12 AC 60 ms
54,140 KB
testcase_13 AC 129 ms
57,696 KB
testcase_14 AC 129 ms
57,856 KB
testcase_15 AC 134 ms
57,708 KB
testcase_16 AC 139 ms
57,940 KB
testcase_17 AC 130 ms
57,612 KB
testcase_18 AC 139 ms
57,820 KB
testcase_19 AC 138 ms
57,668 KB
testcase_20 AC 136 ms
55,760 KB
testcase_21 AC 124 ms
57,812 KB
testcase_22 AC 140 ms
57,804 KB
testcase_23 AC 124 ms
57,636 KB
testcase_24 AC 140 ms
57,708 KB
testcase_25 AC 135 ms
57,648 KB
testcase_26 AC 136 ms
57,544 KB
testcase_27 AC 131 ms
57,628 KB
testcase_28 AC 138 ms
57,620 KB
testcase_29 AC 133 ms
57,736 KB
testcase_30 AC 123 ms
57,676 KB
testcase_31 AC 136 ms
57,640 KB
testcase_32 AC 133 ms
57,640 KB
testcase_33 AC 133 ms
57,776 KB
testcase_34 AC 595 ms
67,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			String[] sa = br.readLine().split(" ");
			char[] n = sa[0].toCharArray();
			int m = Integer.parseInt(sa[1]);
			int m2 = m * 2;

			long v1 = 0;
			for (int i = 0; i < n.length; i++) {
				v1 *= 10;
				v1 += n[i] - '0';
				v1 %= m2;
			}
			long ans = v1 * (v1 + 1) / 2 % m;
			pw.println(ans);
		}
		pw.flush();
		br.close();
	}
}
0