結果
問題 | No.16 累乗の加算 |
ユーザー |
![]() |
提出日時 | 2016-11-02 11:08:16 |
言語 | C90 (gcc 12.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 542 bytes |
コンパイル時間 | 100 ms |
コンパイル使用メモリ | 21,120 KB |
実行使用メモリ | 8,224 KB |
最終ジャッジ日時 | 2024-11-25 01:26:19 |
合計ジャッジ時間 | 60,487 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 TLE * 9 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%lld%lld", &x, &n); | ^~~~~~~~~~~~~~~~~~~~~~~~~ main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%lld", &a[i]); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void) { long long int x, n; long long int a[101]; long long int i, j; long long int total = 0; long long int subtotal; scanf("%lld%lld", &x, &n); for(i = 1;i <= n;i++){ scanf("%lld", &a[i]); } for(i = 1;i <= n;i++){ subtotal= 1; for(j = 0;j < a[i];j++){ subtotal = ((subtotal % 1000003) * (x % 10000003)) % 1000003; } //printf("subtotal = %lld\n", subtotal); total = (total + subtotal) % 1000003; } //printf("total = %lld\n", total % 1000003); printf("%lld\n", total); return 0; }