## 235 - Typesetting

Moderator: Board moderators

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong

### 235 - Typesetting

I have some confustion about the problem statements.

1. Is the input terminated by a dataset of N = 0? Although it should be, it is not clearly written.

2. For each dataset, should we start the paragaph number from 1? Or should we count paragrach for the whole input file? Although it should be former one, it is not clearly written.

3. Under the problem definition, character may be scaled to use 0 unit width. Should we consider it as 1 unit?

4. It is said "The words in each paragraph are sequences of no more than 8 non-blank characters separated by spaces (that is, blanks - no tab characters will appear in the input). Spaces at the ends of input lines are irrelevant". If this is correct, then in sample input

Code: Select all

``````3 100
AAA
AAA BBB CCC
``````
We should consider the first word as "AAAAAA" instead of "AAA".....
I hope this is only a minor mistake instead of a trap....
Last edited by .. on Tue Jan 18, 2005 11:54 am, edited 1 time in total.
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

little joey
Guru
Posts: 1080
Joined: Thu Dec 19, 2002 7:37 pm
The testset for this problem is wrong. I meant to write about it, but somehow simply forgot...

To get accepted for this problem, you have to round up when calculating the actual width of a letter. Although that makes more sense for a real life typesetter, the problem description specifically states that you should round to the nearest integer. So the problemset, which was taken from the original contest data (I suppose), contains this error.

1. I guess so. My continuation condition is

Code: Select all

``while((scanf("%d",&letters)==1)&&letters){``
2. The first alternative.

3. I use actual_width = (width * size +9) / 10, which will always be >0. But as stated this is wrong. It should be actual_width = (width * size +5) / 10, which can be zero.

4. I consider a line break as word separator, so your sample contains 4 words. I agree with you that the description could be more specific in this case.

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong
Oh yes, the testdata is wrong now....
Thanks for the reply, otherwise I will waste much more time to find the non-existing bug.......
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan
I m currently getting WA, but cant find any reason. Can anyone please verify the I/O set?

Input:

Code: Select all

``````5
A 10 20 30 12 22 32
B 1 2 3 4 5 6
C 9 10 8 3 5 2
D 2 4 5 6 7 11
2 4 6 3 5 7
1 1
*f2 A *f2 B *s1 C *s2 D *s99 ABCD
4 100
AAA *f1 *f1 *f2 *s30
*f6 AAA BBB CCC *f3 *s25
ABC *f1 CBA AABC *f6 CACA D
*f4 AABBB B *s21 DAB
0 0
0
``````
Outupt:

Code: Select all

``````Paragraph 1
Line 1: A (-19 whitespace)
Line 2: B (-1 whitespace)
Line 3: C ... C (0 whitespace)
Line 4: D ... D (0 whitespace)
Line 5: ABCD (-356 whitespace)
Paragraph 2
Line 1: AAA ... AAA (70 whitespace)
Line 2: AAA (-188 whitespace)
Line 3: BBB ... CCC (7 whitespace)
Line 4: ABC (-3 whitespace)
Line 5: CBA ... CBA (49 whitespace)
Line 6: AABC ... AABC (24 whitespace)
Line 7: CACA (-70 whitespace)
Line 8: D ... D (72 whitespace)
Line 9: AABBB ... AABBB (10 whitespace)
Line 10: B ... DAB (38 whitespace)
``````

..
A great helper
Posts: 454
Joined: Thu Oct 18, 2001 2:00 am
Location: Hong Kong
Hi,

Here is my output, I think it is the same as you.

Code: Select all

``````Paragraph 1
Line 1: A (-19 whitespace)
Line 2: B (-1 whitespace)
Line 3: C ... C (0 whitespace)
Line 4: D ... D (0 whitespace)
Line 5: ABCD (-356 whitespace)
Paragraph 2
Line 1: AAA ... AAA (70 whitespace)
Line 2: AAA (-188 whitespace)
Line 3: BBB ... CCC (7 whitespace)
Line 4: ABC (-3 whitespace)
Line 5: CBA ... CBA (49 whitespace)
Line 6: AABC ... AABC (24 whitespace)
Line 7: CACA (-70 whitespace)
Line 8: D ... D (72 whitespace)
Line 9: AABBB ... AABBB (10 whitespace)
Line 10: B ... DAB (36 whitespace)
``````
My signature:
We can learn much more in discussion than reading source code.
• I HATE testing account.
• Don't send me source code for debug.

rio
A great helper
Posts: 385
Joined: Thu Sep 21, 2006 5:01 pm
Location: Kyoto, Japan