1 人解决,1 人已尝试。
1 份提交通过,共有 4 份提交。
9.3 EMB 奖励。
单点时限: 2.0 sec
内存限制: 256 MB
Your local computer user’s group publishes a quarterly newsletter, and in each issue there is a small Turbo Pascal programming problem to be solved by the membership. Members submit their solutions to the problem to the newsletter editor, and the member submitting the shortest solution to the problem receives a prize.
The length of a program is measured in units. The unit count is determined by counting all occurrences of reserved words, identifiers, constants, left parentheses, left brackets, and the following operators: +, -, *, /, =, <, >, <=, >=, <>, @, ^, and :=. Comments are ignored, as are all other symbols not falling into one of the categories mentioned above. The program with the lowest unit count is declared the winner. Two or more programs with equal unit counts split the prize for the quarter.
In an effort to speed the judging of the contest, your team has been asked to write a program that will determine the length of a series of Pascal programs and print the number of units in each.
Input to your program will be a series of Turbo Pascal programs. Each program will be terminated by a line containing tilde characters in the first two columns, followed by the name of the submitting member. Each of these programs will be syntactically correct and use the standard symbols for comments (braces) and subscripts (square brackets).
For each program, you are print a separate line containing the name of the submitting member and the unit count of the program. Use a format identical to that of the sample below.
Input to your program will be a series of Turbo Pascal programs. Each program will be terminated by a line containing tilde characters in the first two columns, followed by the name of the submitting member. Each of these programs will be syntactically correct and use the standard symbols for comments (braces) and subscripts (square brackets).
For each program, you are print a separate line containing the name of the submitting member and the unit count of the program. Use a format identical to that of the sample below.
1 人解决,1 人已尝试。
1 份提交通过,共有 4 份提交。
9.3 EMB 奖励。