Solve of UVA 12750: Keep Rafa at Chelsea!
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int i,j,k,l,n,m,a,b,tst;
char x[500];
cin>>tst;
for(i=1;i<=tst;i++)
{
cin>>n;
for(j=0;j<n;j++)
cin>>x[j];
for(j=0;j<n;j++)
{
if(x[j]!='W' && x[j+1]!='W' && x[j+2]!='W')
{
b=j+3;
break;
}
}
if(b>n)
{
printf("Case %d: Yay! Mighty Rafa persists!\n",i);
}
else
printf("Case %d: %d\n",i,b);
}
return 0;
}
Please do not copy paste the code. Understand it. If there's any problem make a comment.
Thank you.
Thanks
ReplyDelete