給定一個整數n,返回n!結果尾數中零的數量
阿新 • • 發佈:2021-01-25
以上是朋友圈中一奇葩貼:“2月14情人節了,我決定造福大家。第2個贊和第14個讚的,我介紹你倆認識…………咱三吃飯…你倆請…”。現給出此貼下點讚的朋友名單,請你找出那兩位要請客的倒黴蛋。
輸入格式:
輸入按照點讚的先後順序給出不知道多少個點讚的人名,每個人名佔一行,為不超過10個英文字母的非空單詞,以回車結束。一個英文句點.標誌輸入的結束,這個符號不算在點贊名單裡。
輸出格式:
根據點贊情況在一行中輸出結論:若存在第2個人A和第14個人B,則輸出“A and B are inviting you to dinner…”;若只有A沒有B,則輸出“A is the only one for you…”;若連A都沒有,則輸出“Momo… No one is for you …”。
輸入樣例1:
GaoXZh
Magi
Einst
Quark
LaoLao
FatMouse
ZhaShen
fantacy
latesum
SenSen
QuanQuan
whatever
whenever
Potaty
hahaha
.
輸出樣例1:
Magi and Potaty are inviting you to dinner...
輸入樣例2:
LaoLao
FatMouse
whoever
.
輸出樣例2:
FatMouse is the only one for you...
輸入樣例3:
LaoLao
.
輸出樣例3:
Momo... No one is for you ...
AC碼
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s,A,B;
int count=0;
cin >> s;
while(s!=".")
{
count++;
if(count==2)
A=s;
if(count==14)
B=s;
cin >> s;
}
if(count>=14)
cout << A << " and " << B << " are inviting you to dinner...";
else if(count<2)
cout << "Momo... No one is for you ...";
else
cout << A << " is the only one for you...";
return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
string A,B;
int count=0;
cin >> s;
while(s!=".")
{
count++;
if(count==2)
A=s;
if(count==14)
B=s;
cin >> s;
}
if(A!=""&&B!="")
cout << A << " and " << B << " are inviting you to dinner...";
else if(A!=""&&B=="")
cout << A << " is the only one for you...";
else if(A==""&&B=="")
cout << "Momo... No one is for you ...";
return 0;
}