結果

問題 No.1343 Dividing Digit
ユーザー さかぽんさかぽん
提出日時 2021-01-16 13:43:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 2,272 ms
コンパイル使用メモリ 102,808 KB
実行使用メモリ 29,292 KB
最終ジャッジ日時 2023-08-18 10:17:03
合計ジャッジ時間 5,804 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,408 KB
testcase_01 AC 59 ms
23,412 KB
testcase_02 AC 60 ms
21,576 KB
testcase_03 AC 96 ms
27,044 KB
testcase_04 AC 69 ms
19,848 KB
testcase_05 AC 74 ms
22,628 KB
testcase_06 AC 72 ms
24,316 KB
testcase_07 AC 77 ms
23,308 KB
testcase_08 AC 91 ms
28,564 KB
testcase_09 AC 93 ms
26,956 KB
testcase_10 AC 70 ms
22,204 KB
testcase_11 AC 77 ms
23,184 KB
testcase_12 AC 89 ms
28,300 KB
testcase_13 AC 86 ms
25,588 KB
testcase_14 AC 70 ms
22,168 KB
testcase_15 AC 76 ms
22,508 KB
testcase_16 AC 72 ms
24,128 KB
testcase_17 AC 93 ms
28,764 KB
testcase_18 AC 96 ms
27,284 KB
testcase_19 AC 90 ms
25,456 KB
testcase_20 AC 78 ms
25,412 KB
testcase_21 AC 91 ms
26,700 KB
testcase_22 AC 92 ms
26,604 KB
testcase_23 AC 97 ms
29,292 KB
testcase_24 AC 90 ms
26,100 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

class B
{
	static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
	static (int, int) Read2() { var a = Read(); return (a[0], a[1]); }
	static void Main()
	{
		var (n, k) = Read2();
		var a = Read();

		var m = a.Sum();
		long r = 0, p = 1;

		for (int i = 0; i < n; i++)
		{
			r += a[n - 1 - i] * p;
			p = p * k % m;
		}
		Console.WriteLine(r % m);
	}
}
0