L1-035 情人节
题目 L1-035 情人节
思路分析
代码实现
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
using ll = long long;
using ull = unsigned long long;
using PII = pair<int,int>;
using Pll = pair<ll,ll>;
int dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
const int inf = 0x3f3f3f3f;
signed main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
string s;
int cnt=0;
bool haveA=false,haveB=false;
string A,B;
while(cin>>s){
if(s==".") break;
// cout<<s<<endl;
cnt++;
if(cnt==2) {
haveA=true;
A=s;
}
if(cnt == 14){
haveB=true;
B=s;
}
}
if(haveA && haveB){
cout<<A<<" and "<<B<<" are inviting you to dinner...";
}else if(haveA){
cout<<A<<" is the only one for you...";
}else{
cout<<"Momo... No one is for you ...";
}
return 0;
}
同类题型
视频讲解
⬅️ L1-034 点赞 🏠 00-天梯赛 ➡️ L1-036 A乘以B
💬 评论