• 微信公众号：美女很有趣。 工作之余，放松一下，关注即送10G+美女照片！

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

4小时前 2次浏览

## A题

``````#include <bits/stdc++.h>
#define re register
#define pb push_back
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long ;
const int N = 1e5+10 ;
int fan(int n){
int res=0;
while(n){
res+=n%10;
n/=10;
}
return res;
}
vector<int>ans;
int check(int n){
int cnt=0;
for(int i=1;i<=n;i++)
if(fan(i)>fan(i+1))cnt++;
return cnt;
}
void solve()
{
int n;cin>>n;
int cnt=0;
if(n%10==9) cnt=1;
cout<<n/10+cnt<<"n";
}
int main()
{
ios::sync_with_stdio(false);
int t=1;
cin>>t;
while(t--)
solve();
return 0;
}
``````

## B题

``````#include <bits/stdc++.h>
#define re register
#define pb push_back
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long ;
const int N = 1e4+10 ;
char a[N],b[N];
int n,m;
bool flag=0;
void dfs(int u,int v,int cnt){
if(flag)return ;
if(u+1<=n){
if(a[u+1]==b[v+1]){
dfs(u+1,v+1,cnt+1);
}
}
int x=u,y=v;
while(true){
if(x-1>=1&&a[x-1]==b[y+1])x--,y++;
else break;
}
if(y==m)flag=1;
}
void solve()
{
flag=0;
cin>>(a+1)>>(b+1);
n=strlen(a+1);
m=strlen(b+1);
for(int i=1;i<=n;i++)
if(a[i]==b[1]){
dfs(i,1,0);
if(flag){
cout<<"YESn";
return ;
}
}
cout<<"NOn";
}
int main()
{
ios::sync_with_stdio(false);
int t=1;
cin>>t;
while(t--)
solve();
return 0;
}
``````

## C题

``````#include <bits/stdc++.h>
#define re register
#define pb push_back
#define all(a) a.begin(),a.end()
using namespace std;
using ll = long long ;
char s[110];
void solve()
{
cin>>s;
int ans=10;
for(int t=0;t<1<<12;t++){
bool f=1;
int a=0,b=0,res=10;
for(int i=0;i<10;i++){
int u=t>>i&1;
if(s[i]!='?'&&(s[i]-'0')!=u){
f=0;
break;
}
if(u){
if(i%2==0)a++;
else b++;
}
if(a>b){
if(abs(a-b)>(10-i)/2) res=min(res,i+1);
}
else{
if(abs(a-b)>(10-i-1)/2) res=min(res,i+1);
}
}
if(f)ans=min(ans,res);
if(0){
for(int i=0;i<10;i++)
cout<<(t>>i&1)<<" ";
cout<<endl;
}
}
cout<<ans<<"n";
}
int main()
{
ios::sync_with_stdio(false);
int t=1;
cin>>t;
while(t--)
solve();
return 0;
}
``````