牛客2023跨年场 | “朝闻道”知识分享大赛

重生带我走 重生带我走 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

这是我参加???的第10086篇,哦,原来已经结束了,那没事了。

吐槽篇:

社区原来每天上限发篇数是10篇?还想跟上年一样发一篇最后的跨年牛客场,看来还是遗憾了qwq

比赛吐槽:

气死我了,被一道题卡死了,不知道为啥就是过不了。上年还能AK跨年赛,今年直接被打沉默了,思路不对吗?很对吧?我吐了。。。

我好气啊,为什么为什么为什么为什么为什么???

img

比赛完后应该rating------------------------------了。

竞赛篇:

比赛链接:https://ac.nowcoder.com/acm/contest/70257

A 小沙的悬崖

思路:签到题,最少也就是恰好选中那个点,即1,不过需要特判下真是1的情况!

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define cf(_) int _;cin >> _;while(_--)

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b){return b ? gcd(b,a % b) : a;}

int main()
{
    int n;
    cin >> n;
    if (n != 1) cout << 1;
    else    cout << 0;
    return 0;
}

C 嘤嘤的悬崖

思路:枚举一下左右边界就行了,你问我为什么?因为时间复杂度:O(n)

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define cf(_) int _;cin >> _;while(_--)

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b){return b ? gcd(b,a % b) : a;}

int main()
{
    int n;
    cin >> n;

    vector<pii> a(n + 1);
    for (int i = 1; i <= n; i++)    cin >> a[i].first >> a[i].second;

    int res = 0;
    for (int i = 1; i <= n; i++)
    {
        res = max({res, a[i].first - a[i - 1].first, a[i].first - a[i - 1].second, a[i].second - a[i - 1].first, a[i].second - a[i - 1].second});
    }

    cout << res << "\n";
    return 0;
}

F Kevin大战僵尸

题意:植物大战僵尸,问开始多少能量可以获胜?

思路:诈骗题,比赛过程跟舍友聊了聊植物大战僵尸的思路,聊着聊着答案就出来了qwq。答案就是50,因为向日葵肉多,虽然吃???

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define cf(_) int _;cin >> _;while(_--)

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b){return b ? gcd(b,a % b) : a;}

int main()
{
    cout << 50;
    return 0;
}

G 寻找阿卡林

思路:

就是找图论的相关算法名称,生成树的相关算法名称,以及NTT、FFT等。

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define cf(_) int _;cin >> _;while(_--)

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b){return b ? gcd(b,a % b) : a;}

int main()
{
    cout << "justback";
    return 0;
}

H !啦年过

题意:给了段录音,问翻译过来中文是什么?

思路:给的是倒放的录音,用软件处理一下,是中文的“元旦快乐”

#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

#define IOS ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define cf(_) int _;cin >> _;while(_--)

mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x;}
ll gcd(ll a,ll b){return b ? gcd(b,a % b) : a;}

int main()
{
    cout << "元旦快乐";
    return 0;
}
...全文
评论
收藏 已收藏
分享
返回顶部