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;
}
}