#K79387. Calculate Completed Task Percentage

    ID: 35297 Type: Default 1000ms 256MiB

Calculate Completed Task Percentage

Calculate Completed Task Percentage

You are given a list of tasks. Each task is described by a title and a status indicating whether it is completed or not. The input is provided via standard input (stdin) in the following format:

  • The first line contains an integer n denoting the number of tasks.
  • Each of the next n lines contains a task description where the last token is an integer flag (1 for completed and 0 for not completed). The tokens before the flag represent the task title (which may consist of several words).

Your task is to calculate the percentage of tasks that are completed. Let m be the number of completed tasks and n be the total number of tasks. The percentage is computed as

$$\text{percentage} = \text{round}\left(\frac{m}{n} \times 100\right) $$

If no tasks are provided (n = 0), output 0.

inputFormat

The input is read from stdin and consists of multiple lines:

  • The first line contains an integer n representing the total number of tasks.
  • The following n lines each contain a task description. Each line ends with an integer (1 for completed and 0 for not completed). The rest of the line (which may include spaces) is the task title.

outputFormat

Output a single integer to stdout which is the rounded percentage of tasks completed.

## sample
0
0

</p>