思路:我不配…
#include<iostream>
using namespace std;
string s1 = "XiaoQiao";
string s2 = "XiaoHuiHui";
int main()
{
string s;
cin>>s;
int j = 0,k = 0;
for(int i = 0 ;i<s.size();i++)
{
if(s[i]==s1[j])j++;
if(s[i]==s2[k])k++;
}if(j==s1.size()&&k==s2.size())cout<<"Happy"<<endl;
else cout<<"emm";
}
B 牛能和小镇 思路:排序找前n-1个最小的即可
#include<bits/stdc++.h>
#define N 100000
using namespace std;
typedef long long LL;
LL a[N];
int main()
{
int n;
cin>>n;
for(int i=1;i<=n;++i)
{
int x,y;
cin>>x>>y;
a[i] = 1LL*x*x*y+1LL*y*y*(y-2*x);
}
sort(a+1,a+n+1);
LL ans = 0;
for(int i=1;i<n;++i) ans += abs(a[i]-a[i+1]);
cout<<ans<<endl;
return 0;
}
C 装备合成 思路:水题
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int T;
ll a,b;
cin>>T;
while(T--){
cin>>a>>b;
ll lima=a/2;
ll ans=(a+b)/5;
if((a+b)%5==0&&a&1)--ans;
ans=min(lima,ans);
ans=min(b,ans);
cout<<ans<<endl;
}
return 0;
}
D 水啊!!
#include<iostream>
using namespace std;
int main()
{
int t;scanf("%d",&t);
while(t--)
{
long long int n,x=3;
scanf("%lld",&n);
while(x<n)
x=x*4+1;
if(n<=x/2)
cout<<"XiaoQiao"<<endl;
else
cout<<"XiaoHuiHui"<<endl;
}
return 0;
}