結果
| 問題 |
No.16 累乗の加算
|
| コンテスト | |
| ユーザー |
カルロス
|
| 提出日時 | 2015-08-31 15:25:34 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 456 bytes |
| コンパイル時間 | 177 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-18 16:58:06 |
| 合計ジャッジ時間 | 896 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d %d", &x, &N);
| ^~~~~~~~~~~~~~~~~~~~~~
main.c:18:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | scanf("%lld", &a);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
long long mpow(int mx, long long ma){
if(ma==1){return mx;}
if(ma==0){return 1;}
if(ma%2==1){
return mx * mpow(mx, ma-1) % 1000003;
}else{
return mpow(mx, ma/2) * mpow(mx, ma/2) % 1000003;
}
}
int main(void){
int i, x, N;
scanf("%d %d", &x, &N);
long long t = 0, a;
for(i=0;i<N;i++){
scanf("%lld", &a);
t += mpow(x, a);
}
printf("%lld\n", t);
return 0;
}
カルロス