結果

問題 No.16 累乗の加算
ユーザー hirokazu1020hirokazu1020
提出日時 2015-07-19 16:46:32
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 753 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 75,092 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-22 19:18:21
合計ジャッジ時間 1,291 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<sstream>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
#define indexOf(v,x) (find(all(v),x)-v.begin())

#define MOD 1000003

long long pow_mod(long long x,long long y){
	int res=1;
	while(y){
		if(y&1)res=(res*x)%MOD;
		y>>=1;
		x=(x*x)%MOD;
	}
	return res;
}


int main(){
	int a,n,x,ans=0;
	cin>>x>>n;
	rep(i,n){
		cin>>a;
		ans+=pow_mod(x,a);
	}
	cout<<ans<<endl;
	
	return 0;
}
0