All about problems in Volume 114. If there is a thread about your problem, please use it. If not, create one with its number in the subject.
Moderator: Board moderators
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Mon Nov 10, 2008 11:57 am
Some 1 please help me. It seems easy but can't get Accepted!!!!
Last edited by
Obaida on Thu Nov 13, 2008 9:30 am, edited 1 time in total.
try_try_try_try_&&&
_try@try.com
This may be the address of success.
MRH
Learning poster
Posts: 51 Joined: Mon Aug 11, 2008 9:09 pm
Post
by MRH » Wed Nov 12, 2008 4:26 pm
FRIST TRY TO PASS SAMPLE I/O
YOUR CODE NOT PASS SAMPLE I/O
FOLLOW THIS
1.TAKE TAST CASE
2.NOW PRINT=>Case 1:
#include<string.h>
#include<stdio.h>
int main()
{
3.NOW TAKE STRING .
4.PRINT ALL STRING .
5.PRINT THIS AND END THIS CASE=>printf(“\n”);
return 0;
}
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Thu Nov 13, 2008 9:39 am
Last edited by
Obaida on Sat Mar 07, 2009 6:25 am, edited 1 time in total.
try_try_try_try_&&&
_try@try.com
This may be the address of success.
MRH
Learning poster
Posts: 51 Joined: Mon Aug 11, 2008 9:09 pm
Post
by MRH » Thu Nov 13, 2008 4:54 pm
RTY THIS :
1
NOW GIVE SEVERAL BLANK LINE
MY ACC CODE NOT EXIT THIS TAST CASE
BUT YOUR CODE PRINT BLANK LINE & GO NEXT TAST CASE
I HOPE NOW U GET ACC............................
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Sat Nov 15, 2008 6:35 am
But I think if there is blank line input output should be printf("\n");
By your instruction it got wa again!!!!
try_try_try_try_&&&
_try@try.com
This may be the address of success.
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Thu Dec 18, 2008 11:58 am
I followed every thing i know but kept getting wA!!!!
this is my code. Some one please help me.
Last edited by
Obaida on Sat Dec 20, 2008 12:23 pm, edited 1 time in total.
try_try_try_try_&&&
_try@try.com
This may be the address of success.
Articuno
Learning poster
Posts: 78 Joined: Sun Nov 30, 2008 5:00 pm
Location: IUT-OIC, Dhaka, Bangladesh
Post
by Articuno » Thu Dec 18, 2008 5:56 pm
@ obaida,
You forgot to check for '\' character.
As example, for this case:
The output should be:
Code: Select all
Case 1:
#include<string.h>
#include<stdio.h>
int main()
{
printf("\\Y\n");
printf("\n");
return 0;
}
Hope it will help
May be tomorrow is a better day............
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Sat Dec 20, 2008 12:04 pm
Thank you a lot...................
But it kept getting WA........
try_try_try_try_&&&
_try@try.com
This may be the address of success.
Articuno
Learning poster
Posts: 78 Joined: Sun Nov 30, 2008 5:00 pm
Location: IUT-OIC, Dhaka, Bangladesh
Post
by Articuno » Sat Dec 20, 2008 12:58 pm
@ Obaida, I got AC using your code. Just increase your array size and check for '\' character. That will do.
Wish you good luck
May be tomorrow is a better day............
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Sat Dec 20, 2008 1:05 pm
That was frustrating funny thing
try_try_try_try_&&&
_try@try.com
This may be the address of success.
Articuno
Learning poster
Posts: 78 Joined: Sun Nov 30, 2008 5:00 pm
Location: IUT-OIC, Dhaka, Bangladesh
Post
by Articuno » Sat Dec 20, 2008 2:34 pm
@Obaida,
I don't uderstand why it was WA. Shouldn't it be RTE?
May be tomorrow is a better day............
Obaida
A great helper
Posts: 380 Joined: Wed Jan 16, 2008 6:51 am
Location: (BUBT) Dhaka,Bagladesh.
Post
by Obaida » Sat Dec 20, 2008 4:29 pm
That was wrong answer because,
i was moving the input characters in a single array which was a bit small. For that i missed some data and got wa.
But in the array i took input was large enough to hold the characters. If the array i took input was small then i would get RTE
try_try_try_try_&&&
_try@try.com
This may be the address of success.
allenlam
New poster
Posts: 8 Joined: Tue Jun 09, 2009 6:46 am
Post
by allenlam » Wed Jul 08, 2009 6:04 pm
Use regex to handle the escape chars,
the problem becomes a piece of cake.
Accepted. Funny to create C by Java.
obbY
New poster
Posts: 5 Joined: Sun May 16, 2010 11:41 pm
Post
by obbY » Wed May 26, 2010 8:54 pm
I solved it in C after a few WA, in fact the problem description is wrong since it says to use the following format:
#include<string.h>
#include<stdio.h>
int main()
{
<case specific lines>
printf(“\n”);
return 0;
}
but is should be:
#include<string.h>
#include<stdio.h>
int main()
{
<case specific lines>
printf("\n");
return 0;
}
The difference is that you must use the " character where the problem description uses ascii 147 and 148, hope it helps
Swordfish
New poster
Posts: 1 Joined: Sun Sep 19, 2010 7:32 am
Post
by Swordfish » Sun Sep 19, 2010 7:43 am
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(){
int n, i, j, x = 1 ;
char a[100][100], s[100] ;
while(scanf("%d",&n)==1){
getchar();
if(n == 0)
return 0;
i = 0 ;
while(1){
gets(s);
if (strlen(s) != 0)
strcpy(a[i++], s) ;
if(i == n)
break ;
}
printf("Case %d:\n",x++);
printf("#include<string.h>\n");
printf("#include<stdio.h>\n");
printf("int main()\n") ;
printf("{\n");
for(i=0; i<n; i++){
printf("printf(\"");
for(j=0; j<strlen(a
); j++){
if (a[j] == '"')
printf("\\\"");
else if (a[j] == '\\')
printf("\\\\");
else if (isalnum(a[j]) || a[j] == ' ')
printf("%c",a[j]);
}
printf("\\n\");\n");
}
printf("printf(\"\\n\");\n");
printf("return 0;\n");
printf("}\n");
}
return 0;
}
Why i getting WA.
I think, i satisfy all the requirements. Please help me.