Welcome to the original source-- Blog Park-zhouzhendong go to the blog Park to see the puzzle Topic Portal-BZOJ5091 November month bTest Instructions Summary
Solving
Code
#include <cstring> #include <algorithm> #include <cstdio> #include <cstdlib> #include <cmath >using namespace Std;typedef long long ll;const int n=100005;const LL mod=1000000007; ll Llpow (ll X,ll y) {if (y==0) return 1LL; LL Xx=llpow (X,Y/2); Xx=xx*xx%mod;if (Y&1LL) Xx=xx*x%mod;return xx;} ll Inv (ll x) {return Llpow (x,mod-2);} LL N,m,k,d[n],a[n];int Main () {memset (d,0,sizeof D); scanf ("%d%d%d", &n,&m,&k); for (int i=1;i<=n;i++) scanf ("%d", &a[i]), for (int i=1,a,b;i<=m;i++) {scanf ("%d%d", &a,&b);d [a]++,d[b]++;} LL ans=0;for (int i=1;i<=n;i++) ans= (Ans+d[i]*a[i])%mod;printf ("%lld", Ans*inv (m*2)%mod*k%mod); return 0;}
BZOJ5091 picking apples BZOJ2017 November month math derivation inverse element