不太会化简公式,写了个暴力,计算了一下每个wi对应的区间 #include<bits/stdc++.h> using namespace std; typedef pair<int,int>P; vector<P>G[1000]; int main() { int n; scanf("%d",&n); int ans=0; for(int l=1; l<=n; ++l) { for(int r=l; r<=n; ++r) { G[r-l+1].push_back(P(l,r)); } } for(int i=1; i<=n; ++i...