3 条题解

  • 1
    @ 2026-8-19 16:34:03

    #include<bits/stdc++.h>
    using namespace std;
     
    typedef long long LL;
    const int N = 1e5 + 10;
    const LL P = 1e8;
     
    LL a[N];
     
    int main () {
    	ios::sync_with_stdio(false);
    	cin.tie(0);
    	
    	LL n, K;
    	cin >> n >> K;
    	for (int i = 1; i <= n; i ++) {
    		cin >> a[i];
    	}
    	LL ans = 0;
    	for (int j = 1; j <= n; j ++) {
    		LL sum = 0;
    		LL t = 1;
    		while (t <= K && t <= a[j]) {
    			LL ii = a[j] / t;
    			LL si = min(K, a[j] / ii);
    			sum += (si - t + 1) * min(ii * (a[j] + 2), P);
    			t = si + 1;
    		}
    		ans += sum;
    	}
    	cout << ans << "\n";
    	
    	return 0;
    } 
    
    

    信息

    ID
    12635
    时间
    2000ms
    内存
    512MiB
    难度
    8
    标签
    递交数
    94
    已通过
    17
    上传者