結果

問題 No.2649 [Cherry 6th Tune C] Anthem Flower
ユーザー ks2mks2m
提出日時 2024-02-23 21:35:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 3,148 ms
コンパイル使用メモリ 74,780 KB
実行使用メモリ 73,148 KB
最終ジャッジ日時 2024-02-23 21:35:17
合計ジャッジ時間 13,103 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
54,136 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 126 ms
57,824 KB
testcase_15 WA -
testcase_16 AC 130 ms
57,768 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 118 ms
57,656 KB
testcase_24 AC 122 ms
57,664 KB
testcase_25 WA -
testcase_26 AC 129 ms
57,812 KB
testcase_27 AC 130 ms
57,552 KB
testcase_28 AC 124 ms
57,628 KB
testcase_29 WA -
testcase_30 AC 129 ms
57,696 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

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]);

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