Page 2 of 15
Posted: Mon Mar 31, 2003 9:24 pm
by little joey
Dominik: I print them and get accepted!
I was in doubt when I reviewed my code for my post in this thread, but I rechecked it, and it is so. Not even P.E. but plain AC.
Posted: Tue Apr 01, 2003 8:11 am
by Dominik Michniewski
Hmmm, that's strange ....
If I correct remember statements say, that spaces at end of line should be avoided .... (I got P.E. - maybe instead of that ?)
Dominik
Posted: Thu Apr 03, 2003 4:54 pm
by raysa
Sorry to interrupt, but I just last my WA's by replacing NULL string '\0' with whitespace...
They really make me think that they ARE right, Dominik!
Thank's to Hisoka and Little Joey...
Regards,
Raysa
Problem 490
Posted: Sat Apr 05, 2003 9:49 am
by de
I got Wrong Answer
but I don't know why ><...
[cpp]
#include <iostream.h>
#include <string.h>
#include <stdio.h>
int main()
{
char data[101][101];
int msize;
int n,t,t2;
for (t=0 ;t<=100 ;t++)
data[0][t]=' ';
n=0;
// freopen ("482in.txt","r",stdin);
msize=0;
while (gets (data[n]))
{
if (strlen(data[n])>msize)
msize=strlen (data[n]);
n++;
for (t=0 ;t<=100 ;t++)
data[n][t]=' ';
}
for (t=0 ;t<msize ;t++)
{
for (t2=n-1 ;t2>=0 ;t2--)
cout << data[t2][t];
cout << endl;
}
return 0;
}
[/cpp]
Thanks!
Posted: Sat Apr 05, 2003 3:09 pm
by afonsocsc
Input:
"
.
,m
da
i
aI
s
e
er
co
nf
oe
r
se
eh
tt
r
a,
ck
en
Di
h
et
n
eI
R"
your output:
Rene Decartes once said,
"Ithink,thereforeIam."
should be:
Rene Decartes once said,
"I think, therefore I am."
Try to rotate strings four times, they should be like they were in the beginning...
490 - Rotating Sentences [WA]
Posted: Mon Aug 11, 2003 3:38 pm
by pcncvl
I cannot find out what is wrong with my code... can anyone help me and take a look?
Many thanks!
[c]
#include <iostream.h>
#include <stdio.h>
int main()
{
char chArr[200][200];
char **chOut;
char chIn;
int I, J;
int K, L;
int intLines;
int intLongest = 0;
bool firstchar = true;
//freopen("test_in.txt","r",stdin);
//freopen("test_out.txt","w",stdout);
for (I = 0; I < 100; I++)
{
for (J = 0; J < 100; J++)
chArr[J] = '\0';
}
I = J = 0;
intLines = 0;
while (scanf("%c",&chIn)==1)
{
if (chIn == '\t' || chIn == '\r')
continue;
if (chIn == '\n')
{
J++;
intLines++;
I = 0;
continue;
}
chArr[J] = chIn;
I++;
if (I > intLongest)
intLongest = I;
}
intLines += 1;
chOut = new char*[intLines];
for (I = 0; I < intLines; I++)
chOut = new char[intLongest];
K = L = 0;
for (I = 0; I < intLongest; I++)
{
K = 0;
for (J = intLines - 1; J >=0; J--)
{
chOut[K][L] = chArr[J];
K++;
}
L++;
}
for (I = 0; I < intLongest; I++)
{
for (J = 0; J < intLines; J++)
cout << chOut[J];
if (I != intLongest - 1)
cout << endl;
}
return 0;
}
[/c]
Posted: Tue Aug 12, 2003 4:27 am
by Observer
Hello!
I've tested your program and found that it suffers from Presentation Errors. So I would suggest the following modifications:
1. Delete line 46: intLines += 1;
2. Delete line 72: if (I != intLongest - 1)
Try it and get AC!
490 wa, plizzzzzzzzzzzzzzz help me :(:(:(
Posted: Thu Aug 21, 2003 9:43 pm
by Riyad
Posted: Thu Aug 21, 2003 10:26 pm
by UFP2161
INPUT
Code: Select all
test
test test
test test test
test test
test
YOUR OUTPUT
Code: Select all
ttttt
eeeee
sssss
ttttt
ttt
eee
sss
ttt
t
e
s
t
EXPECTED OUTPUT
Code: Select all
ttttt
eeeee
sssss
ttttt
ttt
eee
sss
ttt
t
e
s
t
still wa:(:(:( plizzzzzzzzzzzzzzzzzz help
Posted: Fri Aug 22, 2003 6:51 am
by Riyad
490 why WA???
Posted: Tue Nov 25, 2003 6:20 pm
by slonko
hi! i have WA whu? plz help
[c]
#include <stdio.h>
#include <string.h>
main()
{
char tab[102][102];
int spr[102];
char t;
int i=0,n,max=0;
int j=0;
t=getchar();
while(t!=EOF)
{
char s;
j=0;
while (t!='\n' && t!=EOF)
{
if (t!='\t' && t!='\r'){
tab[j]=t;
j++;
}
t=getchar();
}
s=t;
t=getchar();
tab[j]='\0';
spr=1;
i++;
}
n=i;
for (i=0;i<n;i++)
if (max<strlen(tab))
max=strlen(tab);
for (i=0;i<max+1;i++)
{
int j;
for (j=n-1;j>=0;j--)
{
if (spr[j])
{
if (tab[j]!=0)
putchar(tab[j]);
else
{
spr[j]=0;
putchar(' ');
}
}
else
putchar(' ');
}
putchar('\n');
}
}
[/c]
WA, WA, WA!!
Posted: Tue Dec 23, 2003 5:58 am
by gcp
Why WA?
I've ever looked all posts about this problem, but none helped me.
[cpp]
#include <iostream.h>
#include <string.h>
void main()
{ char matriz[102][102];
int cont, max;
cont=0;
max=0;
while (cin.getline(matriz[cont],100,'\n'))
{ if (strlen(matriz[cont])>max) max=strlen(matriz[cont]);
cont++;
}
for (int i=0; i<max; i++)
{ for (int j=cont-1; j>=0; j--)
if (strlen(matriz[j])>i)
cout << matriz[j];
else cout << " ";
cout << endl;
}
}
[/cpp][/code]
i got WA on 490, can you help me?
Posted: Sun Jun 20, 2004 1:38 pm
by snake79
Here is my code... i tried to substitute '\0' in the array "str" with spaces but i still get WA. I saw some topics about 490 but i didn't found where i'm wrong... can you help me?
[c]
#include <stdio.h>
#include <string.h>
main()
{
char str[103][103]={'\0'};
int i=0,j,maxl=0,k,pos;
while( fgets(str,102,stdin) )
{
pos=(strlen(str)-1);
if (pos<0) pos=0;
if (str[pos]=='\n') str[pos]='\0'; /* Erases fgets' '\n'*/
if ( maxl<strlen(str) ) maxl=strlen(str);
++i;
}
--i;
for (k=0;k<maxl;k++)
{
for(j=i;j>=0;j--)
{
printf("%c",str[j][k]);
}
printf("\n");
}
}
[/c]
Thanks in advance!
490 with WA~~~
Posted: Fri Oct 29, 2004 1:14 pm
by Wei
I don't know where is wrong~~
Could anybody help me???
[c]#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i=-1,j=-1,k,l,max=0;
char ch[105][105],a;
while(scanf("%c",&a)!=EOF)
{
i++;
j=-1;
while(a!=10)
{
if(a!=9)
{
j++;
ch[j]=a;
}
scanf("%c",&a);
}
if(j>max)
max=j;
}
for(l=0;l<=max;l++)
{
for(k=i;k>=0;k--)
printf("%c",ch[k][l]);
printf("\n");
}
return 0;
}[/c]
Posted: Sun Oct 31, 2004 9:57 am
by A1
in printing section add this code:
Code: Select all
for(k=i........)
{
if(ch[k][l]<='\0')
ch[k][l]=' ';
printf(.........);
}
and make your array size little bigger
Note: problem statement is false, about input size!!
