結果
問題 | No.16 累乗の加算 |
ユーザー |
![]() |
提出日時 | 2025-03-11 09:51:03 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 542 bytes |
コンパイル時間 | 3,920 ms |
コンパイル使用メモリ | 25,216 KB |
実行使用メモリ | 8,860 KB |
最終ジャッジ日時 | 2025-03-11 09:51:18 |
合計ジャッジ時間 | 7,237 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 WA * 1 TLE * 1 -- * 11 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%lld%lld",&num,&element); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.c:13:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%lld",&value); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>int main(void){// 入力された値(変数値・項の数)long long num, element;scanf("%lld%lld",&num,&element);// 累乗の合計long long ans = 0;// 入力された値(各項の指数値)long long value = 0;// 項の数だけループfor(long long i = 0;i < element;i++){scanf("%lld",&value);// 指数値の数だけループして累乗するlong long tmp = 1;for(long long i = 1;i <= value;i++){tmp *= num;}ans += tmp;}ans = ans % 1000003;printf("%lld",ans);}