Codeforces 1288(A,B,C)Round 80 (Rated for Div.2)

题目链接:https://codeforces.com/contest/1288
A. Deadline
题意:给你n,d两个数,是否满足min(n , x + [ d / ( x + 1 ) ] ) <=d,(其中0<x<n,而⌈2.4⌉=3 , ⌈2⌉=2),如果满足输出YES,否则输出NO。
思路:其实这个题中只要n/2和n/2+1满足条件即可。
AC代码

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
const int MAXN=2e5+5;
bool cheak(int d, int x, int n)
{
    double tmp = d / (x * 1.0);
    if(tmp != d / x) tmp = d / x + 1;
    if(x - 1 + tmp <= n) return 1;
    else return 0;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int t; cin >> t;
    while (t -- ){
        int n, d;
        cin >> n >> d;
        if(n >= d) cout << "YES" << endl;
        else {
            int x = n / 2 + 1, y = n / 2 + 2;
            if(cheak(d,x,n)||cheak(d,y,n)) cout << "YES" << endl;
            else cout << "NO" << endl;
        }
    }
    return 0;
}

B. Yet Another Meme Problem
题意:给您两个整数A和B,计算对(a,b)的对数,使得1≤a≤A,1≤b≤B,以及等式a⋅b+ a + b = conc(a,b) 是真的; conc(a,b)是a和b的串联(例如,conc(12,23)= 1223,conc(100,11)= 10011)。 a和b不应包含前导零。
思路:其实只要统计0~b之间有多少个像9,99,999,9999,这样全是9的数x个,答案就是a*x啦。
AC代码

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
typedef long long ll;
const int INF=0x3f3f3f3f;
const int MAXN=2e5+5;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    ll t; cin >> t;
    while(t -- ){
        ll a, b, ans = 0;
        cin >> a >> b;
        ll x = a, y = b;
        ll res = 0, tmp = 0;
        while(y){
            tmp ++ ;
            res = res * 10 + 9;
            y /= 10;
        }
        if(res > b) tmp -- ;
        ans = x * tmp;
        cout << ans << endl;
    }
    return 0;
}

C. Two Arrays
题意:给出两个整数n和m。 计算数组对(a,b)的数量,使得:
两个数组的长度等于m;
每个数组的每个元素都是1到n(含)之间的整数;
对于从1到m的任何索引i,ai≤bi;
数组a以降序排列;
数组b以非升序排序。
结果可能非常大,您应该以1e9 + 7模数打印。
思路:啊啊啊啊,dp我还是不会,太难了,我是解不出来这个题,先把大佬的代码挂出来,之后再来细细推敲。
大佬代码

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
typedef long long ll;
const int INF=0x3f3f3f3f;
const ll mod = 1e9 + 7;
ll dpa[15][1005];
ll dpb[15][1005];
int main()
{
    ll n, m;
    cin >> n >> m;
    //先对a,b进行初始化
    for(int i = 1; i <= n; i++)
    {
        dpa[1][i] = 1;
        dpb[1][i] = 1;
    }
    for(int i = 2; i <= m; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            for(int k = 1; k <= j; k++)
            {
                dpa[i][j] += dpa[i - 1][k];
                dpa[i][j] %= mod;
            }
            for(int k = j; k <= n; k++)
            {
                dpb[i][j] += dpb[i - 1][k];
                dpb[i][j] %= mod;
            }
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = i; j <= n; j++)
        {
            ans += dpa[m][i] * dpb[m][j];
            ans %= mod;
        }
    }
    cout << ans % mod << endl;
    return 0;
}

"educational codeforces round 103 (rated for div. 2)"是一个Codeforces平台上的教育性比赛,专为2级选手设计评级。以下是有关该比赛的回答。 "educational codeforces round 103 (rated for div. 2)"是一场Codeforces平台上的教育性比赛。Codeforces是一个为程序员提供竞赛和评级的在线平台。这场比赛是专为2级选手设计的,这意味着它适合那些在算法和数据结构方面已经积累了一定经验的选手参与。 与其他Codeforces比赛一样,这场比赛将由多个问题组成,选手需要根据给定的问题描述和测试用例,编写程序来解决这些问题。比赛的时限通常有两到三个小时,选手需要在规定的时间内提交他们的解答。他们的程序将在Codeforces的在线评测系统上运行,并根据程序的正确性和效率进行评分。 该比赛被称为"educational",意味着比赛的目的是教育性的,而不是针对专业的竞争性。这种教育性比赛为选手提供了一个学习和提高他们编程技能的机会。即使选手没有在比赛中获得很高的排名,他们也可以从其他选手的解决方案中学习,并通过参与讨论获得更多的知识。 参加"educational codeforces round 103 (rated for div. 2)"对于2级选手来说是很有意义的。他们可以通过解决难度适中的问题来测试和巩固他们的算法和编程技巧。另外,这种比赛对于提高解决问题能力,锻炼思维和提高团队合作能力也是非常有帮助的。 总的来说,"educational codeforces round 103 (rated for div. 2)"是一场为2级选手设计的教育性比赛,旨在提高他们的编程技能和算法能力。参与这样的比赛可以为选手提供学习和进步的机会,同时也促进了编程社区的交流与合作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值