|시간 제한||메모리 제한||제출||정답||맞힌 사람||정답 비율|
|1 초||128 MB||29||18||18||72.000%|
ACM (Advanced Communication Machinery) is a famous mobile-phone manufacturing company. Nowadays, programmers of ACM are making a GUI for their brand-new mobile phone, ACM Touch. Designers want a scrollbar interface on it. A scrollbar is a graphical object in a GUI with which continuous text, pictures or anything else can be scrolled including time in video applications, i.e., viewed even if it does not fit into the space in a computer display, window, or viewport. A scroll bar is usually designed as a long rectangular area on one or two sides of the viewing area, containing a bar that can be dragged along a track to move the body of the document. To compute the size of the thumb, we need to know the length on which the whole document is displayed.
In ACM Touch, a text is displayed by following manner:
You are to program that calculates the minimum number of rows to display a given text. Assume that every word’s length is less than or equal to the width of columns.
Example: “ACM is short for Association for Computing Machinery” can be displayed as follows. The former is suitable for ACM Touch, but the latter is not.
The input contains several test cases. The first line of the input contains an integer number 1 ≤ T ≤ 20 that indicates the number of test cases. In each test case, the first line is an integer 1 ≤ w ≤ 100 indicating the width of the mobile phone screen. The second line is the text to display. The length of text is not larger than 2000 characters. You can assume that there is no word whose length is longer than w. Texts are composed by the Roman alphabets.
Your program is to write to standard output. For each test case, print an integer indicating the minimum number of lines needed to display the text according to the manner described above.
5 6 I am Sam 20 A mobile phone is an electronic device used for longrange mobile telecommunications over a cellular network of specialized base stations known as cell sites 16 For each test case output an integer indicating the number of lines needed to display the text according to the manner described above 16 A thumb that completely fills the trough indicates that the entire document is being viewed at which point the scrollbar may temporarily become hidden 7 Abcdefg hijklmn opqrstu vwxyz
2 10 10 11 4