結果

問題 No.16 累乗の加算
ユーザー TwizzTwizz
提出日時 2017-05-10 21:29:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 435 bytes
コンパイル時間 1,596 ms
コンパイル使用メモリ 143,864 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-13 10:05:42
合計ジャッジ時間 4,076 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include"bits/stdc++.h"
//#include<bits/stdc++.h>
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
const int mod = 1e9 + 7;

ll dp[102];

int main() {
	int x, n;
	ll a[102];
	ll ans = 0;
	cin >> x >> n;
	rep(i, 0, n)cin >> a[i];
	dp[0] = 1; dp[1] = x;
	rep(i, 2, 102) {
		dp[i] = dp[i-1] * x%mod;
	}
	rep(i, 0, n) {
		ans += dp[a[i]] % mod;
	}
	print(ans);
	return 0;
}
0