Harbour.Space Scholarship Contest 2021-2022 (open for everyone, rated, Div. 1 + Div. 2)(A - D)

A

太简单了,写完就删了

B
有很多人暴力搜,或者其他方法,样例不严谨过了,然后就被hack了

#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
    int t;
    cin>>t;
    while (t--)
    {
        string str,s,KK;
        cin>>str;
        cin>>s;
        int n = str.length();
        string HH[n];
        bool flag = false;
        for (int i=0;i<n;i++)
        {
            HH[i]+= KK;
            KK+=str[i];
            reverse(KK.begin(),KK.end());
            HH[i]+= KK;
            reverse(KK.begin(),KK.end());
            if (HH[i].find(s)!=HH[i].npos) flag = true;
        }
        if (flag==true) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}

C
这道也很简单,思维题

#include <iostream>
#include <algorithm>
#include <set>
#include <cstring>
using namespace std;
#define int long long
signed main()
{
    int t;
    cin >> t;
    while (t--)
    {
        char str[12];
        cin >> str + 1;
        // char aa[12],bb[12];
        int cou = 0;
        int a = 5, b = 5; //最高
        int A = 0, B = 0; //最低
        for (int i = 1; i <= 10; i++)
        {
            ++cou;
            if (i % 2 == 1)
            {
                if (str[i] == '1')
                    A++;
                else if (str[i] == '0')
                    a--;
                else
                {
                    A++;
                    a--;
                }
            }
            else
            {
                if (str[i] == '1')
                    B++;
                else if (str[i] == '0')
                    b--;
                else
                {
                    B++;
                    b--;
                }
            }
            // cout << a << " " << A << endl;
            // cout << b << " " << B << endl;
            if (B > a || A > b)
                break;
        }
        cout << cou << endl;
    }
}

D
这道题也有很多人被hack了,不知道写的啥玩意
这道题想出来就很简单,想不出来就。。。。寄

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
#define int long long
signed main()
{
    int t;
    cin >> t;
    while (t--)
    {
        string str,s;
        cin>>str>>s;
        int i,j;
        for (i=str.length()-1,j = s.length()-1;i>=0;i--)
        {
            if (str[i]==s[j])
            {
                --j;
            }
            else --i;
            if (j==-1) break;
        }
        if (j==-1) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值