結果

問題 No.16 累乗の加算
ユーザー suzu
提出日時 2023-05-09 10:00:41
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 603 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 106,496 KB
実行使用メモリ 36,736 KB
最終ジャッジ日時 2024-11-25 22:00:23
合計ジャッジ時間 68,289 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 TLE * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
class Program
{
    static void Main(string[] args)
    {
		var line1 = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();
		int x = line1[0];
		int n = line1[1];
		
		var array = Console.ReadLine().Split(' ').Select(c => int.Parse(c)).ToArray();
		
		int remainder = 0;
		int divide = 1000003;
		
		for(int i = 0;i < n;i++)
		{
			int a = 1;
			for(int p = 0;p < array[i];p++)
			{
				a *= x;
				int b = a / divide;
				a -= b * divide;
			}
			remainder += a;
			
		}
		Console.WriteLine(remainder % divide);
    }
}
0