对于最后一句话:“>的个数是bn/m"
因为0<=bi+1-bi<m, 那么找>就是找有多少个点 bi/m 从x到x+1(0->1,1->2类似于这样子的),那么这样子到n时前面就有 bn/m 个这样子的点
#include <bits/stdc++.h> using namespace std; #define endl "\n" typedef long long ll; const int N = 1e6 + 5; ll a[N]; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); ll n; cin >> n; for (int i = 0; i < n; i++)cin >> a[i]; ll n1, m, x; cin >> n1 >> m >> x; ll sum1 = x % m, sum = 0; for (int i = 0; i < n; i++) { sum += a[i] % m; } sum1 += n1/n*sum; for (int i = 0; i < n1 % n; i++) { sum1 += a[i] % m; } cout << n1 - sum1 / m; return 0; }
标签:转换,int,ll,cin,sum1,++,n1,除法,mod From: https://www.cnblogs.com/zhujio/p/17438939.html