結果
問題 |
No.1081 和の和
|
ユーザー |
![]() |
提出日時 | 2025-03-19 10:19:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 340 bytes |
コンパイル時間 | 276 ms |
コンパイル使用メモリ | 28,288 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-19 10:19:30 |
合計ジャッジ時間 | 924 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d", &val); | ~~~~~^~~~~~~~~~~~ main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%lld", &num[i]); | ~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main() { int val = 0; scanf("%d", &val); long long int num[val]; for (int i = 0; i < val; i++){ scanf("%lld", &num[i]); } long long int p = 1000000007; for (int i = 0; i < val - 1; i++){ for (int j = 0; j < val - i; j++){ num[j] = (num[j] + num[j + 1]) % p; } } printf("%lld\n", num[0]); return 0; }