Page 1 of 2

11483 - Code Creator

Posted: Mon Nov 10, 2008 11:57 am
by Obaida
Some 1 please help me. It seems easy but can't get Accepted!!!!
:(

Code: Select all

Deleted

Re: 11483 WA

Posted: Wed Nov 12, 2008 4:26 pm
by MRH
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;
}

Re: 11483 WA

Posted: Thu Nov 13, 2008 9:39 am
by Obaida
still wa :evil: :evil: :evil:

Code: Select all

removed

Re: 11483 WA

Posted: Thu Nov 13, 2008 4:54 pm
by MRH
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............................

Re: 11483 WA

Posted: Sat Nov 15, 2008 6:35 am
by Obaida
But I think if there is blank line input output should be printf("\n");
By your instruction it got wa again!!!!

Re: 11483 WA

Posted: Thu Dec 18, 2008 11:58 am
by Obaida
I followed every thing i know but kept getting wA!!!!
this is my code. Some one please help me.

Code: Select all

removed

Re: 11483 WA

Posted: Thu Dec 18, 2008 5:56 pm
by Articuno
@ obaida,
You forgot to check for '\' character.
As example, for this case:

Code: Select all

1
\Y
0
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 :)

Re: 11483 WA

Posted: Sat Dec 20, 2008 12:04 pm
by Obaida
Thank you a lot................... :)
But it kept getting WA........ :o

Re: 11483 WA

Posted: Sat Dec 20, 2008 12:58 pm
by Articuno
@ Obaida, I got AC using your code. Just increase your array size and check for '\' character. That will do.
Wish you good luck :)

Re: 11483 WA

Posted: Sat Dec 20, 2008 1:05 pm
by Obaida
That was frustrating funny thing :-?

Re: 11483 WA

Posted: Sat Dec 20, 2008 2:34 pm
by Articuno
@Obaida,
I don't uderstand why it was WA. Shouldn't it be RTE?

Re: 11483 WA

Posted: Sat Dec 20, 2008 4:29 pm
by Obaida
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

Re: 11483 - Code Creator

Posted: Wed Jul 08, 2009 6:04 pm
by allenlam
Use regex to handle the escape chars,
the problem becomes a piece of cake.

Accepted. Funny to create C by Java.

Re: 11483 - Code Creator

Posted: Wed May 26, 2010 8:54 pm
by obbY
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

Re: 11483 - Code Creator

Posted: Sun Sep 19, 2010 7:43 am
by Swordfish
#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. :-?