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
11734 - Big Number of Teams will Solve This
Moderator: Board moderators
-
- New poster
- Posts: 36
- Joined: Sun Mar 18, 2012 8:18 am
Re: 11734 why WA???
getting WA..not getting reason..help
#include<stdio.h>
#include<string.h>
int main()
{
char judge[50], team[50], test[50];
int i, n, tst, j;
scanf("%d", &n);
for(tst = 1; tst <= n; tst++)
{
scanf(" %[^\n]", team);
scanf(" %[^\n]", judge);
if(strcmp(team, judge) == 0)
printf("Case %d: Yes\n", tst);
else
{
for(i = 0, j = 0; team != '\0'; i++)
{
if(team == ' ')
continue;
else
{
test[j] = team;
j++;
}
}
test[j] = '\0';
if(strcmp(test, judge) == 0)
printf("Case %d: Output Format Error\n", tst);
else
printf("Case %d: Wrong Answer\n", tst);
}
}
return 0;
}
#include<stdio.h>
#include<string.h>
int main()
{
char judge[50], team[50], test[50];
int i, n, tst, j;
scanf("%d", &n);
for(tst = 1; tst <= n; tst++)
{
scanf(" %[^\n]", team);
scanf(" %[^\n]", judge);
if(strcmp(team, judge) == 0)
printf("Case %d: Yes\n", tst);
else
{
for(i = 0, j = 0; team != '\0'; i++)
{
if(team == ' ')
continue;
else
{
test[j] = team;
j++;
}
}
test[j] = '\0';
if(strcmp(test, judge) == 0)
printf("Case %d: Output Format Error\n", tst);
else
printf("Case %d: Wrong Answer\n", tst);
}
}
return 0;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11734 why WA???
Input
AC 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
Check input and AC output for thousands of problems on uDebug!
Re: 11734 why WA???
brianfry713,
Thanks for the test cases.
Also, here's some other input / output I found useful during testing / debugging.
Input:
AC Output:
Thanks for the test cases.
Also, here's some other input / output I found useful during testing / debugging.
Input:
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
WA 11734 - Big Number of Teams will Solve This
Getting WA!! Can't find bug. help please
Code: Select all
Code Removed after got AC :D
Last edited by mhsn06 on Wed Aug 20, 2014 5:49 pm, edited 1 time in total.
Re: WA 11734 - Big Number of Teams will Solve This
Use search and check input in existing threads.
http://acm.uva.es/board/search.php?keyw ... 8e41046297
One example
Maybe in some compilers initialization of some variables coincides with zero value. That's why it works ok on your compiler.
Your output
http://acm.uva.es/board/search.php?keyw ... 8e41046297
One example
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
Maybe in some compilers initialization of some variables coincides with zero value. That's why it works ok on your compiler.
Your output
Code: Select all
Case 1: Wrong Answer
Case 2: Wrong Answer
Last edited by lighted on Tue Sep 23, 2014 12:02 pm, edited 1 time in total.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: WA 11734 - Big Number of Teams will Solve This
Finally got AC.
Check for the AC input. For future
Check for the AC input. For future
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.
-
- New poster
- Posts: 13
- Joined: Tue Jul 08, 2014 7:14 pm
Re: 11734 - Big Number of Teams will Solve This
can't understand why " cin>>n " doesn't work. if i input the value of n and hit enter button, it takes the value of t(string) too. " getline(t); " and "cin>>n; " works togather, i cannot hit enter key between them. but i works after 2nd case . here's the code , pls help.......
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;
}
Re: 11734 - Big Number of Teams will Solve This
Try to add line
Code: Select all
cin>>n;
while (getchar() != '\n') ;
while(n)
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: 11734 why WA???
Hi v1n1t sir ,
May be the sample inputs are not given int the data set , my AC code does not match some of your input .... I have a question .... I can,t understood How the second input
result got Output Format Error ???I mean this one
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
May be the sample inputs are not given int the data set , my AC code does not match some of your input .... I have a question .... I can,t understood How the second input
result got Output Format Error ???I mean this one
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
I know I am a Failure Guy .
Re: 11734 - Big Number of Teams will Solve This
The first line is the team’s output and it contains extra spaces. You can check critical input on uDebug. http://www.udebug.com/UVa/11734
So correct answer is
So correct answer is
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.
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman
Re: 11734 - Big Number of Teams will Solve This
I am getting Wrong Answer. I can't find the bug. Below is my code
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;
}
Last edited by brianfry713 on Fri Jun 19, 2015 7:06 am, edited 1 time in total.
Reason: Added code blocks
Reason: Added code blocks