CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table

Posted lytwajue

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table相关的知识,希望对你有一定的参考价值。




二分!!!


AC代码例如以下:



#include<iostream>
#include<cstring>
#include<cstdio>
#define ll long long
using namespace std;

ll n,m,k;

ll work(ll a)
{
    ll i,j;
    ll ans=0;
    for(i=1;i<=n;i++)
    {
        j=a/i;
        if(j>m)
            j=m;
        ans+=j;
    }
    return ans;
}

int main()
{
    scanf("%I64d%I64d%I64d",&n,&m,&k);
    ll l,r,mid;
    l=1;
    r=n*m+1;
    while(l<r)
    {
        mid=(l+r)/2;
        //cout<<mid<<"!!!!!!!!!!!!!!!!!!!!!!"<<work(mid)<<endl;
        if(work(mid)<k) l=mid+1;
        else r=mid;
    }
    cout<<r<<endl;
    return 0;
}


以上是关于CF Codeforces Round #256 (Div. 2) D (448D) Multiplication Table的主要内容,如果未能解决你的问题,请参考以下文章

cf 20190307 Codeforces Round #543 (Div. 2, based on Technocup 2019 Final Round)

CF A. Phoenix and Balance Codeforces Round #638 (Div. 2) 5月1号

打CF,学算法——一星级Codeforces Round #313 (Div. 2) A. Currency System in Geraldion

打CF,学算法——二星级Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)

Codeforces Round #377 (Div. 2)题解报告

cf之路,1,Codeforces Round #345 (Div. 2)