Page 4 of 7

Posted: Tue Jul 05, 2005 10:29 pm
by jaracz
I've got also P.E. and I really dont know how to fix it too.
Have anyone got AC?

Posted: Thu Jul 07, 2005 5:10 pm
by roticv
Try making an input with 5 rows and 4 columns but only 15 entries.

Do you print extra spaces for this special case? I got alot of WA because of it

Posted: Thu Jul 07, 2005 10:48 pm
by jaracz
no extra spaces :( maybe the rest of row should be filled with spaces so that all 60 signs occur?

400-WA any1 pls help

Posted: Sun Jul 10, 2005 9:28 pm
by 59557RC
i had been stack in this prob. 4 many days.can any1 pls help me.
what's wrong:
#include<stdio.h>
#include<string.h>



int main(void)
{

char str[100][61],temp[61];
int c,r,i,j,k,n,s,t,len[100],max;

while(scanf("%d",&n) !=EOF){max=0;
for(i=0;i<n;i++) {scanf("%s",str);
if(max<strlen(str)) max=strlen(str);}

for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(strcmp(str,str[j])>0){
strcpy(temp,str);
strcpy(str,str[j]);
strcpy(str[j],temp); }
}
}
for(i=0;i<n;i++) len=strlen(str);

c=60/(max+2);
if(c>n) c=n;
if(c<1) c=1;
if(n%c==0) r=n/c;
else r=n/c+1;

printf("\n");
for(i=0;i<6;i++) printf("----------");

t=0;s=0;
for(i=0;i<r;i++) {
printf("\n");
for(j=0;j<c;j++) {
printf("%s",str[s+t]);
for(k=max+2;k>=len[s+t];k--) printf(" ");
t+=r;}

s++;t=0;}
printf("\n");

}



return 0;
}

Posted: Sun Jul 10, 2005 10:00 pm
by 59557RC
i think i outputted correctly.so why WA:

#include<stdio.h>
#include<string.h>



int main(void)
{

char str[100][61],temp[61];
int c,r,i,j,k,n,s,t,ma,len[100],max;

while(scanf("%d",&n) !=EOF){max=0;
for(i=0;i<n;i++) {scanf("%s",str);
if(max<strlen(str)) max=strlen(str);}

for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(strcmp(str,str[j])>0){
strcpy(temp,str);
strcpy(str,str[j]);
strcpy(str[j],temp); }
}
}
for(i=0;i<n;i++) len=strlen(str);

c=60/(max+2);
if(c>n) c=n;
if(c<1) c=1;
if(n%c==0) r=n/c;
else r=n/c+1;

for(i=0;i<60;i++) printf("-");

t=0;s=0;
for(i=0;i<r;i++) {
printf("\n");
for(j=0;j<c;j++) {
printf("%s",str[s+t]);
if(j=c-1) ma=max;
else ma=max+2;
for(k=ma;k>=len[s+t];k--) printf(" ");
t+=r;}

s++;t=0;}
printf("\n");

}



return 0;
}

400 - Unix ls

Posted: Thu Aug 18, 2005 4:07 am
by _.B._
Greetings!
Will anyone ACed please post the output for this input?
IF possible, change whitespace character by any other character, or try to post it between "code" quotes.

Thanks in advance!

Posted: Fri Aug 19, 2005 3:07 am
by daveon
Would you like output from a PE code?

P.E. already.

Posted: Fri Aug 19, 2005 5:23 pm
by _.B._
Heya daveon!
daveon wrote:Would you like output from a PE code?
Thanks, but have P.E. already :o
I just can't get rid of it!!!! :evil:

Thanks anyway!

Keep posting!

I want the P.E. output... please...

Posted: Fri Aug 19, 2005 6:05 pm
by guayoyo
Daveon, can you give me the correct output for ._B_. input, i've got WA many times...

Thanks in advance.

Input.

Posted: Sat Aug 20, 2005 4:29 am
by _.B._
I/O at EOPage.

Posted: Sat Aug 20, 2005 4:45 am
by daveon
To guayoyo, seems like Bernardo made slight changes to his input.

INPUT:

Code: Select all

10
tiny
2short4me
very_long_file_name
shorter
size-1
size2
size3
much_longer_name
12345678.123
mid_size_name
12
Weaser
Alfalfa
Stimey
Buckwheat
Porky
Joe
Darla
Cotton
Butch
Froggy
Mrs_Crabapple
P.D.
19
Mr._French
Jody
Buffy
Sissy
Keith
Danny
Lori
Chris
Shirley
Marsha
Jan
Cindy
Carol
Mike
Greg
Peter
Bobby
Alice
Ruben
4
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgz
123456789112345678921234567893123456789412345678951234567896
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
123456789112345678921234567893123456789412345678951234567896
9
tiny
2short4me
very_long_file_name
shorter
size-1
much_longer_name
12345678.123
mid_size_name
z
52
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
z
y
x
w
v
u
t
s
r
q
p
o
n
m
l
k
j
i
h
g
f
e
d
c
b
a
11
tiny
2short4me
very_long_file_name
shorter
size-1
size2
size3
much_longer_name
12345678.123
mid_size_name
zz 
OUTPUT:
. represents a blank space

Code: Select all

------------------------------------------------------------
12345678.123.........size-1...............
2short4me............size2................
mid_size_name........size3................
much_longer_name.....tiny.................
shorter..............very_long_file_name..
------------------------------------------------------------
Alfalfa........Cotton.........Joe............Porky..........
Buckwheat......Darla..........Mrs_Crabapple..Stimey.........
Butch..........Froggy.........P.D............Weaser.........
------------------------------------------------------------
Alice.......Chris.......Jan.........Marsha......Ruben.......
Bobby.......Cindy.......Jody........Mike........Shirley.....
Buffy.......Danny.......Keith.......Mr._French..Sissy.......
Carol.......Greg........Lori........Peter.......
------------------------------------------------------------
123456789112345678921234567893123456789412345678951234567896
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgz
------------------------------------------------------------
12345678.123.........size-1...............
2short4me............tiny.................
mid_size_name........very_long_file_name..
much_longer_name.....z....................
shorter..............
------------------------------------------------------------
a..c..e..g..i..k..m..o..q..s..u..w..y..
b..d..f..h..j..l..n..p..r..t..v..x..z..
------------------------------------------------------------
12345678.123.........size2................
2short4me............size3................
mid_size_name........tiny.................
much_longer_name.....very_long_file_name..
shorter..............zz ..................
size-1...............


ACed.

Posted: Sun Aug 21, 2005 3:53 am
by _.B._
FINALLY!!
ACed :D
It's such a tedious problem.
Thanks Daveon!
Here's some I/O from my ACed program that I believe will help correct P.E.s and W.A.s:

Input:

Code: Select all

10
tiny
2short4me
very_long_file_name
shorter
size-1
size2
size3
much_longer_name
12345678.123
mid_size_name
12
Weaser
Alfalfa
Stimey
Buckwheat
Porky
Joe
Darla
Cotton
Butch
Froggy
Mrs_Crabapple
P.D.
19
Mr._French
Jody
Buffy
Sissy
Keith
Danny
Lori
Chris
Shirley
Marsha
Jan
Cindy
Carol
Mike
Greg
Peter
Bobby
Alice
Ruben
4
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgz
123456789112345678921234567893123456789412345678951234567896
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
123456789112345678921234567893123456789412345678951234567896
9
tiny
2short4me
very_long_file_name
shorter
size-1
much_longer_name
12345678.123
mid_size_name
z
52
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
z
y
x
w
v
u
t
s
r
q
p
o
n
m
l
k
j
i
h
g
f
e
d
c
b
a
11
tiny
2short4me
very_long_file_name
shorter
size-1
size2
size3
much_longer_name
12345678.123
mid_size_name
zz
5
koala.jpg
australia.exe
kangaroo.txt
foo.bar
homer.simpson
2
www_algorithmist_com
acm.uva.es
3
bernardo_acm_unix_ls_accepted
finally
no_more_p_e
Output:

Code: Select all

------------------------------------------------------------
12345678.123.........size-1.............
2short4me............size2..............
mid_size_name........size3..............
much_longer_name.....tiny...............
shorter..............very_long_file_name
------------------------------------------------------------
Alfalfa........Cotton.........Joe............Porky........
Buckwheat......Darla..........Mrs_Crabapple..Stimey.......
Butch..........Froggy.........P.D............Weaser.......
------------------------------------------------------------
Alice.......Chris.......Jan.........Marsha......Ruben.....
Bobby.......Cindy.......Jody........Mike........Shirley...
Buffy.......Danny.......Keith.......Mr._French..Sissy.....
Carol.......Greg........Lori........Peter.......
------------------------------------------------------------
123456789112345678921234567893123456789412345678951234567896
123456789112345678921234567893123456789412345678951234567896
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgh
abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefgz
------------------------------------------------------------
12345678.123.........size-1.............
2short4me............tiny...............
mid_size_name........very_long_file_name
much_longer_name.....z..................
shorter..............
------------------------------------------------------------
a..b..d..e..g..h..j..k..m..n..p..q..s..t..v..w..y..z..
a..c..d..f..g..i..j..l..m..o..p..r..s..u..v..x..y..
b..c..e..f..h..i..k..l..n..o..q..r..t..u..w..x..z..
------------------------------------------------------------
12345678.123.........size2..............
2short4me............size3..............
mid_size_name........tiny...............
much_longer_name.....very_long_file_name
shorter..............zz.................
size-1...............
------------------------------------------------------------
australia.exe..homer.simpson..koala.jpg......
foo.bar........kangaroo.txt...
------------------------------------------------------------
acm.uva.es............www_algorithmist_com
------------------------------------------------------------
bernardo_acm_unix_ls_accepted..no_more_p_e..................
finally........................

Posted: Fri Sep 02, 2005 2:39 pm
by Nazmul Quader Zinnuree
does it run ok on your PC ??

ACM 400 please help

Posted: Sun Feb 26, 2006 10:43 am
by Wei-Ming Chen
what is the output of

Code: Select all

16
1
2aaaaaaaaa
3
4
5
6
7
8
9
10
11
12
13
14
15
16
thanks..
I tried this problem all the afternoon and got WA

Posted: Mon Feb 27, 2006 4:18 am
by chunyi81
Output from my AC code:

Code: Select all

------------------------------------------------------------
1           13          2aaaaaaaaa  6           
10          14          3           7           
11          15          4           8           
12          16          5           9           
Hope this helps.