Thank you brianfry713. I got AC!brianfry713 wrote:InputAC output:Code: Select all
1 no spac please nospaceplease
Code: Select all
Case 1: Wrong Answer
![:)](./images/smilies/icon_smile.gif)
Moderator: Board moderators
Thank you brianfry713. I got AC!brianfry713 wrote:InputAC output:Code: Select all
1 no spac please nospaceplease
Code: Select all
Case 1: Wrong Answer
Code: Select all
2
no space please
nospaceplease
no space please
no space please
Code: Select all
Case 1: Output Format Error
Case 2: Output Format Error
Code: Select all
5
t hisIsLarge but mor
thisIslarge
thisIsLarge
thisIsLarge
t
this
this
LargeWo rd
LargeWord
Code: Select all
Case 1: Wrong Answer
Case 2: Output Format Error
Case 3: Wrong Answer
Case 4: Wrong Answer
Case 5: Output Format Error
Code: Select all
Code Removed after got AC :D
If you would say that you have same output with no error, you have problems with compiler.brianfry713 wrote:InputAC output:Code: Select all
2 no space please nospaceplease no space please no space please
Code: Select all
Case 1: Output Format Error Case 2: Output Format Error
Code: Select all
Case 1: Wrong Answer
Case 2: Wrong Answer
Code: Select all
3
mmmmmmm
mmmmmmmmm
m m m
mmm
m m
m m
Code: Select all
Case 1: Wrong Answer
Case 2: Output Format Error
Case 3: Yes
There MUST be a newline after the last line.
Code: Select all
#include <iostream>
#include <stdio.h>
#include <string>
using namespace std;
int main()
{
string t,j;
int i,n,sp,k,y,cnt,len,len_t,len_j;
cnt=1;
cin>>n;
while(n)
{
getline(cin,t);
getline(cin,j);
len_t=t.length();
len_j=j.length();
if(len_t>len_j)
len=len_t;
else
len=len_j;
sp=0;
k=0;
y=0;
if(t[0]!=j[0])
{
y=1;
goto here;
}
for(i=0;i<len;i++)
{
if(t[i]!=' ')
{
if(t[i]!=j[k])
{
y=1;
break;
}
k++;
}
else
sp=1;
}
here :
if(y)
cout<<"Case "<<cnt<<": Wrong Answer"<<endl;
else if(sp)
cout<<"Case "<<cnt<<": Output Format Error"<<endl;
else
cout<<"Case "<<cnt<<": Yes"<<endl;
cnt++;
n--;
}
return 0;
}
Code: Select all
cin>>n;
while (getchar() != '\n') ;
while(n)
v1n1t wrote:brianfry713,
Thanks for the test cases.
Also, here's some other input / output I found useful during testing / debugging.
Input:AC Output:Code: Select all
5 t hisIsLarge but mor thisIslarge thisIsLarge thisIsLarge t this this LargeWo rd LargeWord
Code: Select all
Case 1: Wrong Answer Case 2: Output Format Error Case 3: Wrong Answer Case 4: Wrong Answer Case 5: Output Format Error
Isn't it an ' Yes ' input sample ??? If Not then please show me the reason ?? please reply me.thisIsLarge
thisIsLarge
And Output is :
Case 2: Output Format Error
Code: Select all
Case 2: Output Format Error
But according to problem description this input is invalid. First line has length 42.Each line consists of at least one and at most 20 characters.
Code: Select all
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char teamInput[50], judgeInput[50];
int numberOfTestCase, teamInputLength, judgeInputLength, i,j,spaceFlag, errorFlag;
cin >> numberOfTestCase;
gets(teamInput);
for (int t = 0; t < numberOfTestCase; t++)
{
gets(teamInput);
gets(judgeInput);
spaceFlag = 0;
errorFlag = 0;
if (strcmp(teamInput, judgeInput) == 0)
{
printf("Case %d: Yes\n",(t+1));
}
else
{
teamInputLength = strlen(teamInput);
judgeInputLength = strlen(judgeInput);
if (judgeInputLength >= teamInputLength)
{
printf("Case %d: Wrong Answer\n", (t + 1));
continue;
}
for (i = 0,j=0; i < teamInputLength ; i++,j++)
{
if (teamInput[i] == ' ')
{
spaceFlag = 1;
i++;
}
if (teamInput[i] != judgeInput[j])
{
errorFlag = 1;
break;
}
}
if (errorFlag)
{
printf("Case %d: Wrong Answer\n", (t + 1));
}
else if (spaceFlag)
{
printf("Case %d: Output Format Error\n", (t + 1));
}
}
}
return 0;
}