# Codeforces Round #619 (Div. 2)(A~D)

AB就基本没什么可说的了，直接看代码就行

## A. Three Strings

#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int main()
{
string a,b,c;
int t;
cin>>t;

while(t--)
{
cin>>a>>b>>c;
bool flag=1;
for(int i=0;i<a.size();i++)
if(c[i]!=a[i]&&c[i]!=b[i])
{
flag=0;
break;
}
if(flag==1)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}



## B. Motarack’s Birthday

#include<bits/stdc++.h>
using namespace std;
const int N=100010;
int n,s[N];
int main()
{
string a,b,c;
int t;
cin>>t;
while(t--)
{
cin>>n;
int mn=0x3f3f3f3f,mx=0;
for(int i=0;i<n;i++)
cin>>s[i];
int m=0,k;
for(int i=0;i<n;i++)
{
if(s[i]==-1)
{
if(i>0&&s[i-1]!=-1)
{
mn=min(s[i-1],mn);
mx=max(s[i-1],mx);
}
if(i<n-1&&s[i+1]!=-1)
{
mn=min(s[i+1],mn);
mx=max(s[i+1],mx);
}
}
if(i&&s[i]!=-1&&s[i-1]!=-1) m=max(m,abs(s[i]-s[i-1]));
}
if(mn==0x3f3f3f3f)
m=0,k=0;
else
{
k=(mx+mn)/2;
m=max(max(mx-k,k-mn),m);
}
cout<<m<<' '<<k<<endl;
}

return 0;
}


## C. Ayoub’s function

#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
const int N=100010;
int t;
ll n,m;
int main()
{
cin>>t;
while(t--)
{
cin>>n>>m;
ll k=n-m,ans=(n+1)*n/2;
ll a=k/(m+1);
ll b=k%(m+1);
ans-=(((a+1)*a/2)*(m+1-b));
ans-=(((a+2)*(a+1)/2)*b);
cout<<ans<<endl;
}
return 0;
}


## D. Time to Run

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N=1e6+10;
vector<pair<int,string> >v,ans;

int main()
{
int n,m,k;  cin>>n>>m>>k;
for(int i=0;i<n-1;i++)
{
if(m-1!=0)
{
v.push_back({m-1,"R"});
v.push_back({m-1,"L"});
}
v.push_back({1,"D"});
}
if(m-1!=0)
v.push_back({m-1,"R"});

for(int i=0;i<m-1;i++)
{
if(n-1!=0)
{
v.push_back({n-1,"U"});
v.push_back({n-1,"D"});
}
v.push_back({1,"L"});
}
if(n-1!=0)
v.push_back({n-1,"U"});

for(int i=0;i<v.size();i++)
{
if(k>=v[i].first)
{
k-=v[i].first;
ans.push_back(v[i]);
}
else if(k!=0&&v[i].first>k)
{
ans.push_back({k,v[i].second});
k=0;
}
}
if(k>0)
cout<<"NO"<<endl;
else
{
cout<<"YES"<<endl;
cout<<ans.size()<<endl;
for(int i=0;i<ans.size();i++)
cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
return 0;
}



07-25 881

07-25 794

07-25 191

07-25 177

07-12 1261

07-25 71

07-25 196

07-25 107

07-12 201

06-24 947

#### Codeforces Round #652 (Div. 2) D题

©️2020 CSDN 皮肤主题: 书香水墨 设计师: CSDN官方博客

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