結果

問題 No.1317 月曜日の朝、WAを出した
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-08 11:10:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 578 bytes
コンパイル時間 3,458 ms
コンパイル使用メモリ 74,888 KB
実行使用メモリ 54,420 KB
最終ジャッジ日時 2024-04-18 02:31:42
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

	    public static void main(String[] args) throws Exception {

	    	Scanner sc = new Scanner(System.in);
	    	int n = sc.nextInt();
	    	int k = sc.nextInt();
	    	int[] ai_Array = new int[n];
	    	long sum = 0;
	    	long sum_bit = 0;
	    	for (int i = 0; i < n; i ++) {
	    		ai_Array[i] = sc.nextInt();
	    		sum_bit += ai_Array[i];
	    	}
	    	sc.close();

	    	for (int i = 0; i < n; i ++ ) {
	    		sum = sum * k + ai_Array[i];
	    		sum %= sum_bit;
	    	}

	    	System.out.println(sum);
	    	}

	    }
0