首页 > 其他分享 >abc090d <枚举计数>

abc090d <枚举计数>

时间:2023-07-20 19:56:07浏览次数:37  
标签:abc090d int LL solv using include

题目

D - Remainder Reminder

代码

Code
// https://atcoder.jp/contests/abc090/tasks/arc091_b
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
using namespace std;
using LL = long long;
using PII = pair<int, int>;

void solv()
{
    int n, k;
    cin >> n >> k;
    LL cnt = 0;
    for (int b = k+1; b <= n; b ++)
    {
        // a = b * x + k <= n
        LL t = 1ll * (b - k) * (n / b) + max(0, n % b - k + 1) - (k == 0);
        cnt += t;
        // cout << b << " --> " << t << endl;
    }
    cout << cnt << endl;
}

int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int T = 1;
	// cin >> T;
    while (T --)
    {
        solv();
    }
    return 0;
}

标签:abc090d,int,LL,solv,using,include
From: https://www.cnblogs.com/o2iginal/p/17556533.html

相关文章