题意
思路:
.......
.......
....
#include <cstdio> using namespace std; typedef long long ll; const int mod = 1e9 + 7; const int N = 3e5 + 10; int n; ll S[N],w[N]; int main(){ scanf("%d",&n); for(int i = 1;i <= n;i++){ ll x;scanf("%lld",&x); S[i] = (S[i-1] + x) % mod; } for(int i = 1;i <= n;i++){ scanf("%lld",w + i); } for(int i = 1;i <= n;i++){ S[i] = (S[i] + S[i - 1]) % mod; } ll ans = 0; for(int i = 1;i <= n;i++){ ans = (ans + (S[n] - S[n - i] - S[i - 1] + mod) * w[i] % mod) % mod; } printf("%lld\n",ans); return 0; }