結果

問題 No.16 累乗の加算
コンテスト
ユーザー id-ord
提出日時 2026-01-11 23:33:49
言語 C++23
(gcc 15.2.0 + boost 1.89.0)
結果
WA  
実行時間 -
コード長 225 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,550 ms
コンパイル使用メモリ 146,452 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2026-01-11 23:34:02
合計ジャッジ時間 2,466 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
int main(){
	int64_t m=1'000'003;
	int64_t x,N,sum=0;
	std::cin>>x>>N;
	while(N--){
		int64_t x_=x,p=1,a;
		std::cin>>a;
		while(a){if(a&1)p*=x_;p%=m;x_*=x_;x_%=m;a/=2;}
		sum+=a;
	}
	std::cout<<(sum%m);
}
0