結果
問題 |
No.1336 Union on Blackboard
|
ユーザー |
![]() |
提出日時 | 2024-09-12 15:11:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 560 bytes |
コンパイル時間 | 1,984 ms |
コンパイル使用メモリ | 192,656 KB |
最終ジャッジ日時 | 2025-02-24 06:45:07 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define int long long #define fr first #define sc second int read(){ int res=0,f=1;char c=getchar(); while (c<'0'||c>'9') {if (c=='-') f=-1;c=getchar();} while (c>='0'&&c<='9') {res=res*10+(c-'0');c=getchar();} return res*f; } const int N=1e6+5,M=1e9+7; int n,a[N],ans; void Main(){ n=read(); for (int i=1;i<=n;i++) a[i]=read(); for (int i=1;i<n;i++){ ans+=(a[1]+a[i+1])%M*a[1]%M*a[i+1]%M; ans%=M,a[1]+=a[i+1],a[1]%=M; } cout<<ans<<'\n'; return ; } signed main(){ int t; cin>>t; while(t--)Main(); }