結果

問題 No.16 累乗の加算
ユーザー しらゆき
提出日時 2015-12-27 10:34:57
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 538 bytes
コンパイル時間 723 ms
コンパイル使用メモリ 104,064 KB
実行使用メモリ 23,296 KB
最終ジャッジ日時 2024-09-19 07:22:27
合計ジャッジ時間 7,295 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 TLE * 1 -- * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Program
{
    static void Main()
    {
        var s = Console.ReadLine().Split();
        int x = int.Parse(s[0]);
        int n = int.Parse(s[1]);
        var a = Console.ReadLine().Split().Select(long.Parse).ToArray();

        long ans = 0;
        int m = 1000003;

        for (int i = 0; i < n; i++)
        {
            int b = 1;
            for (int j = 0; j < a[i]; j++)
                b = b * x % m;
            ans = (ans + b) % m;
        }

        Console.WriteLine(ans);
    }
}
0