結果

問題 No.1343 Dividing Digit
ユーザー tentententen
提出日時 2021-01-18 10:07:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 443 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 2,100 ms
コンパイル使用メモリ 71,184 KB
実行使用メモリ 62,000 KB
最終ジャッジ日時 2023-08-20 17:45:26
合計ジャッジ時間 11,374 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
55,600 KB
testcase_01 AC 101 ms
55,724 KB
testcase_02 AC 101 ms
56,008 KB
testcase_03 AC 393 ms
60,276 KB
testcase_04 AC 204 ms
58,308 KB
testcase_05 AC 264 ms
60,764 KB
testcase_06 AC 228 ms
59,992 KB
testcase_07 AC 293 ms
60,224 KB
testcase_08 AC 398 ms
60,420 KB
testcase_09 AC 443 ms
60,788 KB
testcase_10 AC 241 ms
62,000 KB
testcase_11 AC 286 ms
60,096 KB
testcase_12 AC 359 ms
60,240 KB
testcase_13 AC 348 ms
60,372 KB
testcase_14 AC 222 ms
59,872 KB
testcase_15 AC 286 ms
60,308 KB
testcase_16 AC 220 ms
60,200 KB
testcase_17 AC 384 ms
60,568 KB
testcase_18 AC 419 ms
60,680 KB
testcase_19 AC 379 ms
60,256 KB
testcase_20 AC 308 ms
59,940 KB
testcase_21 AC 401 ms
60,272 KB
testcase_22 AC 376 ms
60,336 KB
testcase_23 AC 420 ms
60,144 KB
testcase_24 AC 376 ms
60,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] arr = new int[n];
		int total = 0;
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		    total += arr[i];
		}
		long ans = 0;
		for (int i = 0; i < n; i++) {
		    ans *= k;
		    ans += arr[i];
		    ans %= total;
		}
		System.out.println(ans);
	}
}
0