Good Morning Time Limit:1000 ms Memory Limit:65536 kBSolved:

Good Morning
Time Limit:1000 ms Memory Limit:65536 kB
Solved:108 Tried:1269
Description
Sam loves Lily very much that he shows his love to her through all kinds of ways.This morning,Lily received an e-mail from Sam.Lily knows that Sam hided "good morning" in this mail.Lily tried several ways to resort the letters (including the space ' ') so that more "good morning"s could be found.The number of "good morning" appeared in a specified string equals the number of positions from which Lily could see a consecutive string "good morning".
With so many letters,Lily is about to be dizzy.She asks you to tell her what is the maximum number of "good morning"s appear in this mail after rearranged in some way.
Input
First an integer T (T =1&&t
gg回帖 1年前 已收到1个回答 举报

replay911 幼苗

共回答了18个问题采纳率:100% 举报

#include
#include
#include
#include
#include
using namespace std;
int main()
{
int t,i;
int cas=0;
string str;
int num[10];
cin>>t;
getline(cin,str);
while(t--)
{
memset(num,0,sizeof(num));
getline(cin,str);
for(i=0;i0) num[0]--;num[1]/=3;num[4]/=2;
int count=*min_element(num,num+7) ;
cout

1年前

7
可能相似的问题
Copyright © 2024 YULUCN.COM - 雨露学习互助 - 16 q. 0.037 s. - webmaster@yulucn.com