結果
| 問題 | No.1096 Range Sums |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-08-29 02:08:15 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 267 bytes |
| コンパイル時間 | 315 ms |
| コンパイル使用メモリ | 26,184 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-08-29 02:08:17 |
| 合計ジャッジ時間 | 1,745 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d", &N);
| ^~~~~~~~~~~~~~~
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lld", &a);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main() {
int N;
scanf("%d", &N);
long long ans = 0;
for (int i = 1; i <= N; i++) {
long long a;
scanf("%lld", &a);
ans += a * (long long)i * (N - i + 1);
}
printf("%lld\n", ans);
return 0;
}
vjudge1