1759A - Yes-Yes - CodeForces Solution


implementation strings *800

Please click on ads to support us..

Python Code:

t=i=0
liste=[]
while(t<1 or t>1000):
	t=int(input())
for i in range(t):
	s=input()
	while(len(s)>50 or len(s)<1):
		s=input()
	liste.append(s)
for s in liste:
	if s in 'Yes'*50 :
		print('Yes')
	else:
	   print('No')
	  
    

C++ Code:

#include<bits/stdc++.h>
using namespace std ;
#define  ll long long
#define ld long double
#define  LM10 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ld long double
/*
bool f = false;
int cnt = 0  ;
int partition (int arr[] , int l , int h)
{
    int p = arr[l] ;
    int i= l ;
    int j=h ;
    while(i<j)
    {
        do {
            {
                i++ ;
            }
        }while (arr[i]<=p) ;
        do {

                j-- ;

        }while(arr[j]>p) ;
        if(i<j)
        {
            swap(arr[i],arr[j]) ;
            f=true ;

        }
    }
    if (f)
        cnt++ ;
    swap(arr[l],arr[j]) ;
    return j ;
}
void quicksort (int arr[], int left , int right)
{

    if (left<right)
    {
        int piv = partition(arr , left ,right) ;
        quicksort(arr,left,piv) ;
        quicksort(arr,piv+1,right) ;
    }

}
*/


/*
int n , m , cnt  = 0  ;
ll s = 0 ,sum = 0 ;
void solve() {
    cin>>n>>m ;
    ll bytesComp [10004]={};
while(n--)
{
    int a , b ;
    cin>>a>>b ;
    s+=a;
    bytesComp[cnt] = a-b ;
    cnt++ ;
}
bool f = false ;
    sort(bytesComp , bytesComp+cnt) ;
    for (int i = 0; i < cnt; ++i) {
        cout<<bytesComp[i]<<' ';
    }
    cout<<"\n" ;

    for (int i = 0; i < cnt; ++i) {
        sum+= bytesComp[i] ;
        if (sum==s-m){
            cout<<i ;
            f=true ;
            break;
        }
    }
    if (f==false)
         cout<<-1 ;

}
*/
int main(void)
{
LM10
int  tt ;
cin>>tt ;
while(tt--)
{
    string s ;
    cin>>s ;
    string t="YesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYesYes" ;
    if (t.find(s)!=t.npos)
        cout<<"YES\n" ;
    else
        cout<<"NO\n" ;
}

}


Comments

Submit
0 Comments
More Questions

1662A - Organizing SWERC
466C - Number of Ways
1146A - Love "A"
1618D - Array and Operations
1255A - Changing Volume
1710C - XOR Triangle
415C - Mashmokh and Numbers
8A - Train and Peter
591A - Wizards' Duel
1703G - Good Key Bad Key
1705A - Mark the Photographer
1707A - Doremy's IQ
1706B - Making Towers
1325B - CopyCopyCopyCopyCopy
1649C - Weird Sum
1324B - Yet Another Palindrome Problem
525A - Vitaliy and Pie
879A - Borya's Diagnosis
1672B - I love AAAB
1673A - Subtle Substring Subtraction
1345A - Puzzle Pieces
711A - Bus to Udayland
779B - Weird Rounding
1703D - Double Strings
1704C - Virus
63A - Sinking Ship
1704B - Luke is a Foodie
298B - Sail
239A - Two Bags of Potatoes
1704E - Count Seconds