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 » Sun Jun 27, 2004 7:17 am

Help with I/O Please! :evil:

Destination Goa
Experienced poster
Posts: 123
Joined: Thu Feb 10, 2005 4:46 am

Post by Destination Goa » Thu Feb 24, 2005 8:28 pm

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 » Tue Mar 22, 2005 5:21 am

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 » Tue Mar 22, 2005 9:47 am

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 » Tue Mar 22, 2005 8:51 pm

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 » Sat Jul 29, 2006 4:14 pm

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 » Tue Oct 14, 2008 4:59 pm

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 » Wed Oct 15, 2008 7:35 pm

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 » Sat Oct 18, 2008 1:39 pm

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 » Sat Oct 18, 2008 6:28 pm

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 » Sun Oct 19, 2008 3:56 am

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 » Mon Oct 20, 2008 9:13 am

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 » Tue Oct 21, 2008 4:00 am

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 » Tue Oct 21, 2008 7:12 am

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 » Tue Oct 21, 2008 11:16 am

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)”