11946 - Code Number
Moderator: Board moderators
-
- Learning poster
- Posts: 62
- Joined: Sat Nov 21, 2009 10:17 pm
- Location: CUET,Chittagong,Bangladesh
11946- Code Number
I am getting wrong answer... What is th tricky case?
If you have determination, you can do anything you want....![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
Re: 11946- Code Number
I also got W.A many times because I forgot to add \n in the line
n is number of test cases.
Also remember not to print a blank line in the last test case.
Hope this help![:D](./images/smilies/icon_biggrin.gif)
Code: Select all
scanf("%d\n",&n);
Also remember not to print a blank line in the last test case.
Hope this help
![:D](./images/smilies/icon_biggrin.gif)
-
- Learning poster
- Posts: 62
- Joined: Sat Nov 21, 2009 10:17 pm
- Location: CUET,Chittagong,Bangladesh
Re: 11946- Code Number
Still WA.... here is my code...
Code: Select all
// Code Removed after AC.. :D
If you have determination, you can do anything you want....![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
-
- New poster
- Posts: 4
- Joined: Sat Jul 03, 2010 1:04 pm
11946- Code Number
I am getting TLE for this problem. can anyone tell me whats wrong with my code.
#include<stdio.h>
#include<string.h>
char a[91];
int c,i,j,found,got,t,test,line;
int main()
{
scanf("%d",&test);
getchar();
for(t=1;t<=test;t++)
{
while(1)
{
gets(a);
c=strlen(a);
if(c==0)
break;
found=got=0;
found=check();
for(i=0;i<c;i++)
{
if(a=='1')
a='I';
else if(a=='2')
a='Z';
else if(a=='3')
a='E';
else if(a=='4')
a='A';
else if(a=='5')
a='S';
else if(a[i]=='6')
a[i]='G';
else if(a[i]=='7')
a[i]='T';
else if(a[i]=='8')
a[i]='B';
else if(a[i]=='9')
a[i]='P';
else if(a[i]=='0')
a[i]='O';
printf("%c",a[i]);
}
printf("\n");
}
printf("\n");
}
return 0;
}
#include<stdio.h>
#include<string.h>
char a[91];
int c,i,j,found,got,t,test,line;
int main()
{
scanf("%d",&test);
getchar();
for(t=1;t<=test;t++)
{
while(1)
{
gets(a);
c=strlen(a);
if(c==0)
break;
found=got=0;
found=check();
for(i=0;i<c;i++)
{
if(a=='1')
a='I';
else if(a=='2')
a='Z';
else if(a=='3')
a='E';
else if(a=='4')
a='A';
else if(a=='5')
a='S';
else if(a[i]=='6')
a[i]='G';
else if(a[i]=='7')
a[i]='T';
else if(a[i]=='8')
a[i]='B';
else if(a[i]=='9')
a[i]='P';
else if(a[i]=='0')
a[i]='O';
printf("%c",a[i]);
}
printf("\n");
}
printf("\n");
}
return 0;
}
Re: 11946- Code Number
Hi rafai
u arise some problem....
1. please while(1) change--->while(gets(a))
2.problem says print a blank line between test case not at all so be careful and edit ur blank line
3.garbage variable or function be delete.......
ASU(SUST)![:)](./images/smilies/icon_smile.gif)
u arise some problem....
1. please while(1) change--->while(gets(a))
2.problem says print a blank line between test case not at all so be careful and edit ur blank line
3.garbage variable or function be delete.......
ASU(SUST)
![:)](./images/smilies/icon_smile.gif)
-
- Guru
- Posts: 647
- Joined: Wed Jun 26, 2002 10:12 pm
- Location: Hong Kong and New York City
- Contact:
Re: 11946- Code Number
The problem description's encode/decode message for this problem is wrong -- use the sample input/output. It uses some 2s as Z's or something.
Check out http://www.algorithmist.com !
-
- New poster
- Posts: 50
- Joined: Tue May 25, 2010 9:10 am
- Contact:
Re: 11946- Code Number
Hai i m confused with the blank line instance... I have tried every possible way But it failed...Plz this is my code...Some1 who have AC plzz help me....This one is making me creazy.....
![:(](./images/smilies/icon_frown.gif)
![:(](./images/smilies/icon_frown.gif)
Code: Select all
Deleted After AC....Insted of considering line by line..i was considering the whole case....
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... ![:x](./images/smilies/icon_mad.gif)
![:x](./images/smilies/icon_mad.gif)
-
- New poster
- Posts: 23
- Joined: Sun Oct 04, 2009 12:03 pm
Re: 11946- Code Number
hi...
I got WA ! But I cant not figure it out...
Can Anybody help...
my code :
I got WA ! But I cant not figure it out...
Can Anybody help...
my code :
Code: Select all
AC... :)
11946- Code Number
i got WA && also dont under stand input system,plz help
my code is here:
#include<stdio.h>
char a[100];
int c,i,j,found,got,t,test,line,w=0;
int main()
{
scanf("%d",&test);
getchar();
while(test--)
{
while(gets(a) && (a[0]!='\n'))
{
if(c==0)
break;
for(i=0;a!='\0';i++)
{
if(a=='1')
a='I';
else if(a=='2')
a='Z';
else if(a=='3')
a='E';
else if(a=='4')
a='A';
else if(a=='5')
a[i]='S';
else if(a[i]=='6')
a[i]='G';
else if(a[i]=='7')
a[i]='T';
else if(a[i]=='8')
a[i]='B';
else if(a[i]=='9')
a[i]='P';
else if(a[i]=='0')
a[i]='O';
else
{}
}
printf("%s\n",a);
}
}
return 0;
}
my code is here:
#include<stdio.h>
char a[100];
int c,i,j,found,got,t,test,line,w=0;
int main()
{
scanf("%d",&test);
getchar();
while(test--)
{
while(gets(a) && (a[0]!='\n'))
{
if(c==0)
break;
for(i=0;a!='\0';i++)
{
if(a=='1')
a='I';
else if(a=='2')
a='Z';
else if(a=='3')
a='E';
else if(a=='4')
a='A';
else if(a=='5')
a[i]='S';
else if(a[i]=='6')
a[i]='G';
else if(a[i]=='7')
a[i]='T';
else if(a[i]=='8')
a[i]='B';
else if(a[i]=='9')
a[i]='P';
else if(a[i]=='0')
a[i]='O';
else
{}
}
printf("%s\n",a);
}
}
return 0;
}
-
- Learning poster
- Posts: 96
- Joined: Tue Jul 19, 2011 12:19 pm
- Location: Dhaka, Bangladesh
- Contact:
11946- Code Number WA why?
I am also WA. I do not know why? Please, give some critical test cases, please. Please.....
Here is my code.
Here is my code.
Code: Select all
#include <cstdio>
#include <cstring>
#include <cctype>
int main()
{
int T,t,f=0;
//freopen("in-11946.txt","r",stdin);
//freopen("11946.txt","w",stdout);
scanf("%d\n",&T);
for(t=1 ; t<=T ; t++)
{
char ch[500]={'\0'};
while(gets(ch))
{
int len=strlen(ch);
if(f==1 || ch[0]=='\0' || ch[0]=='\n')
{printf("\n\n"); f=0;}
for(int i=0 ; i<len ; i++)
{
if(((ch[i]!=' ' || ch[i]=='.') && ch[i+1]=='\0'))
{
f=1;
}
if(isdigit(ch[i]))
{
if(ch[i]=='0')
printf("O");
else if(ch[i]=='1')
printf("I");
else if(ch[i]=='2')
printf("Z");
else if(ch[i]=='3')
printf("E");
else if(ch[i]=='4')
printf("A");
else if(ch[i]=='5')
printf("S");
else if(ch[i]=='6')
printf("G");
else if(ch[i]=='7')
printf("T");
else if(ch[i]=='8')
printf("B");
else if(ch[i]=='9')
printf("P");
}
else
printf("%c",ch[i]);
}
}
}
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946- Code Number
Your output doesn't match the sample output, it should have the same newlines.
Check input and AC output for thousands of problems on uDebug!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11946- Code Number
snape, c is uninitialized so it equals 0. This statement causes your program to not print anything:
if(c==0)
break;
if(c==0)
break;
Check input and AC output for thousands of problems on uDebug!
-
- Learning poster
- Posts: 96
- Joined: Tue Jul 19, 2011 12:19 pm
- Location: Dhaka, Bangladesh
- Contact:
Re: 11946- Code Number
Hi,
brianfry713
I want to thank you from my heart for your helping.
Actually, I can't spend time on uva problem or any online program because I am busy at Programming camp 2012 (BUET). You know I am new coder so I am learning programming. This camp period is 9:00 AM to 7:00 PM (almost whole day).
So, I will try your test cases and suggestion after this camp.
Thanks again from my heart.
brianfry713
I want to thank you from my heart for your helping.
Actually, I can't spend time on uva problem or any online program because I am busy at Programming camp 2012 (BUET). You know I am new coder so I am learning programming. This camp period is 9:00 AM to 7:00 PM (almost whole day).
So, I will try your test cases and suggestion after this camp.
Thanks again from my heart.
-
- Learning poster
- Posts: 96
- Joined: Tue Jul 19, 2011 12:19 pm
- Location: Dhaka, Bangladesh
- Contact:
Re: 11946- Code Number
Thanks a lot.
Thanks a lot.
Thanks a lot boss.
Your suggestions are so helpful.
Finally, I got it AC.
Thanks a lot.
Thanks a lot boss.
Your suggestions are so helpful.
Finally, I got it AC.
11946 - Code Number
Why I got WA with my code?
Code: Select all
#include<stdio.h>
#include<string.h>
int main()
{
freopen("11946.in","r",stdin);
freopen("11946.out","w",stdout);
int i,j,stat,part=1,flag1=1,flag2=1;
char c[110][100],ans[]={"OIZEASGTBP"};
scanf("%d\n",&stat);
while(part<=stat){
flag1?flag1=0:putchar('\n');
for(i=0;;i++){gets(c[i]);if(c[i][0]=='\0')break;}
for(i=0;c[i][0]!='\0';i++)
for(j=0;c[i][j]!='\0';j++)
if(c[i][j]>='0'&&c[i][j]<='9')
c[i][j]=ans[c[i][j]-'0'];
for(i=0;;i++){
if(c[i][0]=='\0')break;
flag2?flag2=0:putchar('\n');
printf("%s",c[i]);
}
part++;
}
return 0;
}