結果

問題 No.1343 Dividing Digit
ユーザー さかぽんさかぽん
提出日時 2021-01-16 13:43:42
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 1,989 ms
コンパイル使用メモリ 104,960 KB
実行使用メモリ 25,344 KB
最終ジャッジ日時 2024-05-05 15:44:57
合計ジャッジ時間 2,909 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
18,432 KB
testcase_01 AC 21 ms
18,944 KB
testcase_02 AC 21 ms
18,432 KB
testcase_03 AC 53 ms
25,088 KB
testcase_04 AC 28 ms
19,712 KB
testcase_05 AC 33 ms
21,248 KB
testcase_06 AC 30 ms
20,352 KB
testcase_07 AC 35 ms
21,760 KB
testcase_08 AC 47 ms
24,072 KB
testcase_09 AC 50 ms
24,960 KB
testcase_10 AC 28 ms
20,480 KB
testcase_11 AC 34 ms
21,760 KB
testcase_12 AC 44 ms
23,512 KB
testcase_13 AC 43 ms
23,248 KB
testcase_14 AC 32 ms
19,840 KB
testcase_15 AC 34 ms
20,700 KB
testcase_16 AC 28 ms
19,840 KB
testcase_17 AC 49 ms
24,832 KB
testcase_18 AC 54 ms
25,088 KB
testcase_19 AC 44 ms
22,648 KB
testcase_20 AC 38 ms
22,400 KB
testcase_21 AC 49 ms
24,320 KB
testcase_22 AC 50 ms
24,076 KB
testcase_23 AC 57 ms
25,344 KB
testcase_24 AC 50 ms
23,424 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