10659 - Fitting Text into Slides

All about problems in Volume 106. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

abc
New poster
Posts: 15
Joined: Sun Dec 15, 2002 2:51 pm

10659 - Fitting Text into Slides

Post by abc »

Help with I/O Please! :evil:
Destination Goa
Experienced poster
Posts: 123
Joined: Thu Feb 10, 2005 4:46 am

Post by Destination Goa »

My AC solution does not add spaces after last word in a line even if it's not the last word in a paragraph.

Every paragraph begins with a new line.

X is width, Y is height.
To be the best you must become the best!
Emilio
Experienced poster
Posts: 163
Joined: Sun Oct 17, 2004 8:31 pm
Location: Murcia, Spain

Post by Emilio »

Hi!
Can anyone send the output for this, please?

Code: Select all

4
1
abc...
30 100
2
abc,ac
(de)ac
60 100
1
ab,.
30 100
1
a.
28 56
Thanks in advance!
Destination Goa
Experienced poster
Posts: 123
Joined: Thu Feb 10, 2005 4:46 am

Post by Destination Goa »

Code: Select all

No solution
10
No solution
14
To be the best you must become the best!
Emilio
Experienced poster
Posts: 163
Joined: Sun Oct 17, 2004 8:31 pm
Location: Murcia, Spain

Post by Emilio »

First, thanks Destination Goa!
:D
I got AC.
My mistake was '\n' == ' ' == isspace, and not are the same, you must respect '\n' of each text.
daveon
Experienced poster
Posts: 229
Joined: Tue Aug 31, 2004 2:41 am
Location: TORONTO, CANADA

Post by daveon »

Yes, it is not clear from the problem but each paragraph must start on a new line.
DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

10659 - Fitting Text into Slides (WAing)

Post by DD »

Does anyone can provide more I/O cases? This problem let me feel frustrated .
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.
coze
New poster
Posts: 26
Joined: Tue Nov 27, 2007 7:56 am
Location: Japan

Re: 10659 - Fitting Text into Slides

Post by coze »

Heres some io test.

Code: Select all

8
1
a a
16 8
1
a a
17 8
1
aaa bbb
25 100
1
aaaa
27 10
1
aaa bbb ccc
24 24
2
aaaaa
bbbb c
100 100
1
a a
23 8
1
a a
9 30
Output:

Code: Select all

No solution
No solution
8
No solution
8
20
No solution
9
DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

Re: 10659 - Fitting Text into Slides

Post by DD »

coze wrote:Heres some io test.

Code: Select all

8
1
a a
16 8
1
a a
17 8
1
aaa bbb
25 100
1
aaaa
27 10
1
aaa bbb ccc
24 24
2
aaaaa
bbbb c
100 100
1
a a
23 8
1
a a
9 30
Output:

Code: Select all

No solution
No solution
8
No solution
8
20
No solution
9
Thanks for your help, coze. Although my program generated the same output results, I still got W.A. :(

Does anyone can help me test the following input data?
Input:

Code: Select all

2
2
aaaaa
bbbb c
100 40
2
aaaaa
bbbb cc
100 40
Thanks!
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.
coze
New poster
Posts: 26
Joined: Tue Nov 27, 2007 7:56 am
Location: Japan

Re: 10659 - Fitting Text into Slides

Post by coze »

Output:

Code: Select all

16
14
DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

Re: 10659 - Fitting Text into Slides

Post by DD »

coze wrote:Output:

Code: Select all

16
14
Thanks, coze.
It is strange that even my program pass every test case listed in the forum, I still can not get Accepted. :evil:
Does anyone can give me more tricky input/output?

P.S. In my program, I set M to 10000, which I think this value should be big enough.
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.
coze
New poster
Posts: 26
Joined: Tue Nov 27, 2007 7:56 am
Location: Japan

Re: 10659 - Fitting Text into Slides

Post by coze »

Can you show me your source code?
DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

Re: 10659 - Fitting Text into Slides

Post by DD »

coze wrote:Can you show me your source code?
Hi coze, my source code are listed, please check it. :oops:

Code: Select all

Cut code due to A.C.
Last edited by DD on Tue Oct 21, 2008 5:22 pm, edited 1 time in total.
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.
coze
New poster
Posts: 26
Joined: Tue Nov 27, 2007 7:56 am
Location: Japan

Re: 10659 - Fitting Text into Slides

Post by coze »

Try this:

input:

Code: Select all

1
1
aaa bbbbb
56 16
your output:

Code: Select all

No solution
my output:

Code: Select all

8
DD
Experienced poster
Posts: 145
Joined: Thu Aug 14, 2003 8:42 am
Location: Mountain View, California
Contact:

Re: 10659 - Fitting Text into Slides

Post by DD »

coze wrote:Try this:

input:

Code: Select all

1
1
aaa bbbbb
56 16
your output:

Code: Select all

No solution
my output:

Code: Select all

8
First of all, thanks for your help, coze. But I still got W.A. after fixing the bug which I did not consider before. :evil:
Please help me check again, thanks. :oops:

Code: Select all

Cut code due to A.C.
Last edited by DD on Tue Oct 21, 2008 5:22 pm, edited 1 time in total.
Have you ever...
  • Wanted to work at best companies?
  • Struggled with interview problems that could be solved in 15 minutes?
  • Wished you could study real-world problems?
If so, you need to read Elements of Programming Interviews.
Post Reply

Return to “Volume 106 (10600-10699)”