第十四届蓝桥杯三月真题刷题训练——第 10 天(3.13)

Think_bird 2023-03-13 22:18:04

裁纸刀

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int ans = 4;
    ans += 19;
    ans += 20 * 21;
    cout << ans;

    return 0;
}

刷题统计

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    long long a, b, n;
    cin >> a >> b >> n;
    long long ans = (n / (a * 5 + b * 2)) * 7;
    n %= (a * 5 + b * 2);
    if(n <= a * 5) ans += (n + a - 1) / a;
    else ans += 5 + (n - (5 * a) + b - 1) / b;
    cout << ans;
    
    return 0;
}

修剪灌木

#include <bits/stdc++.h>

using namespace std;

int n, a[10005];

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n;
    if(n == 1) cout << 1;
    else
    {
        int t = (n - 1) * 2;
        int l = 1, r = n;
        while(l <= r)
        {
            a[l ++ ] = t;
            a[r -- ] = t;
            t -= 2;
        }
        for(int i = 1; i <= n; i ++ )
            cout << a[i] << "\n";
    }
    return 0;
}

k倍区间(朴素版)

#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    long long n, k, res;
    cin >> n >> k;
    long long a[n + 1] = {0}, cnt[n + 1] = {1};
    for(int i = 1; i <= n; i ++ )
    {
        cin >> a[i];
        a[i] += a[i - 1];
        res += cnt[a[i] % k];
        cnt[a[i] % k] ++;
    }
    cout << res;
    
    return 0;
}

 

...全文
36 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

50,779

社区成员

发帖
与我相关
我的任务
社区描述
和众多高校算法内卷分子,一起学习和交流算法那。浓郁的算法交流氛围,拒绝躺平,有效内卷。加入我们,私信我拉你入核心内卷群。
算法数据结构leetcode 个人社区
社区管理员
  • 执 梗
  • Dream-Y.ocean
  • ღCauchyོꦿ࿐
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

 刷题!

试试用AI创作助手写篇文章吧